Description Usage Arguments Constructors Methods Author(s) Examples
The MultiGraph class represents a single node set and a set of edge sets. Each edge set is either directed or undirected. We can think of an edge in a MultiGraph as a 4tuple (fromnode, tonode, edgetype, weight), where the edgetype field in the tuple identifies the edge set, the weight is a numeric value, and the order of the nodes only matters in the case of a directed edge set. Unlike some of the graph representations, selfloops are allowed (fromnode == tonode).
There is support for arbitrary edge attributes which is primarily useful for rendering plots of MultiGraphs. These attributes are stored separately from the edge weights to facilitate efficient edge weight computation.
1 2 3 4 5 6  MultiGraph(edgeSets, nodes = NULL, directed = TRUE, ignore_dup_edges = FALSE)
eweights(object, names.sep = NULL)
edgeSetIntersect0(g, edgeFun = NULL)
edgeSetIntersect0(g, edgeFun = NULL)
extractGraphAM(g, edgeSets)
extractGraphBAM(g, edgeSets)

edgeSets 
A named list of 
nodes 
A character vector of node labels. Nodes with zero degree can be
included in a graph by specifying the node labels in 
directed 
A logical vector indicating whether the edge sets specified in

object 
A 
g 
A 
names.sep 
The string to use as a separator between from and to node labels.
If 
ignore_dup_edges 
If 
edgeFun 
A user specified named list of functions to resolve edge attributes in a union or intersection operation 
MultiGraph
Return the nodes of the multigraph.
Return an integer vector named by edge set containing edge counts for each edge set.
Return the number of nodes in the multigraph.
Return a list named by edge set; each element is a numeric vector of edge weights for the corresponding edge set.
Return a logical vector named by the edge sets in
object
with a TRUE
indicating a directed edge set
and FALSE
for undirected.
Returns a list named by edge set; for the edges in the MultiGraph
Returns a list named by the edge set; for the names of the edges in the MultiGraph
Return a list named by the edge sets; each element is a data frame with column names from, to and weight corresponding to the connected nodes in the edge set.
Return a new MultiGraph
object
representing the subset of edge sets from the original
MultiGraph
.
Return a named list
of graphAM
objects corresponding to the edge sets from the original
MultiGraph
.
Return a named list
of graphBAM
objects corresponding to the edge sets from the original
MultiGraph
.
Return a new MultiGraph
object in which all
edge sets have been converted to undirected edge sets. This
operation sets all edge weights to one and drops other edge
attributes.
Return a new MultiGraph
object
representing the intersection of edges across all edge sets within
g
. The return value will have a single edge set if the edge
sets in g
are disjoint. Otherwise, there will be a single
edge set containing the shared edges. The node set is preserved.
Edge weights and edge attributes are transferred over to the output if they
have the same value, else user has the option of providing a function
to resolve the conflict.
Return a new MultiGraph
object
representing the union of edges across all edge sets within
g
. The node set is preserved. Edge weights and edge attributes are
transferred over to the output if they have the same value, else user has
the option of providing a function to resolve the conflict.
graphIntersect(x, y, nodeFun, edgeFun)
When given two MultiGraph
objects, graphIntersect
returns a new MultiGraph
containing the nodes and edges in
common between the two graphs. The intersection is computed by
first finding the intersection of the node sets, obtaining the
induced subgraphs, and finding the intersection of the resulting
edge sets. The corresponding named edgeSets in x
and y
should
both be either directed or undirected.Node/Edge attributes that are equal
are carried over to the result. Non equal edge/node attributes will result
in the corresponding attribute being set to NA. The user has the option
of providing a named list(names of edgeSets) of list (names of edge attributes)
of edge functions correspoding to the names of the edge attributes for
resolving conflicting edge attributes (edgeFun
). For resolving any
of the conflicting node attributes, the user has the option of providing a
named list
of functions corresponding to the node attribute names (nodeFun
).
graphUnion(x, y, nodeFun, edgeFun)
When given two MultiGraph
objects, graphUnion
returns a new MultiGraph
containing the union of nodes and
edges between the two graphs. The corresponding pairs of named edgeSets
in x
and y
should both be either directed or undirected.
Non equal edge/node attributes will result in the corresponding attribute
being set to NA. The user has the option of providing a named list(names of
edgeSets) of list (names of edge attributes) of edge functions correspoding
to the names of the edge attributes for resolving conflicting edge
attributes (edgeFun
). For resolving any of the conflicting node attributes, the user
has the option of providing a named list
of functions corresponding
to the node attribute names (nodeFun
).
edgeSets(object, ...)
Returns the names of the edgeSets in the MultiGraph
object
as a character vector.
Prints a short summary of a MultiGraph object
S. Falcon, Gopalakrishnan N
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40  ft1 < data.frame(from=c("a", "a", "a", "b", "b"),
to=c("b", "c", "d", "a", "d"),
weight=c(1, 3.1, 5.4, 1, 2.2),
stringsAsFactors = TRUE)
ft2 < data.frame(from=c("a", "a", "a", "x", "x", "c"),
to=c("b", "c", "x", "y", "c", "a"),
weight=c(3.4, 2.6, 1, 1, 1, 7.9),
stringsAsFactors = TRUE)
esets < list(es1=ft1, es2=ft2)
g < MultiGraph(esets)
nodes(g)
numEdges(g)
eweights(g)
eweights(g, names.sep = "=>")
isDirected(g)
edges(g, edgeSet ="es1")
edges(g, "a", "es1")
edgeNames(g, "es2")
edgeSets(g)
ug < ugraph(g)
isDirected(ug)
numEdges(ug)
edgeSetIntersect0(g)
subsetEdgeSets(g, "es1")
extractFromTo(g)
extractGraphAM(g)
extractGraphAM(g, "es1")
extractGraphBAM(g, "es1")
graphIntersect(g, g)
graphUnion(g,g)
mgEdgeDataDefaults(g, "es1", attr = "color" ) < "white"
mgEdgeData(g, "es1", from = "a", to = c("b", "c"), attr = "color") < "red"
mgEdgeData(g, "es1", from = "a", to = c("b", "c"), attr = "color")
nodeDataDefaults(g, attr ="shape") < "circle"
nodeData(g, n = c("a", "b", "c"), attr = "shape") < "triangle"
nodeData(g, n = c("a", "b", "x", "y"), attr = "shape")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.