Union of graphsSource:
The union of two or more graphs are created. The graphs may have identical or overlapping vertex sets.
# S3 method for igraph union(..., byname = "auto")
Graph objects or lists of graph objects.
A logical scalar, or the character scalar
auto. Whether to perform the operation based on symbolic vertex names. If it is
auto, that means
TRUEif all graphs are named and
FALSEotherwise. A warning is generated if
autoand some (but not all) graphs are named.
union() creates the union of two or more graphs. Edges which are
included in at least one graph will be part of the new graph. This function
can be also used via the
byname argument is
auto and all graphs
are named), then the operation is performed on symbolic vertex names instead
of the internal numeric vertex ids.
union() keeps the attributes of all graphs. All graph, vertex and
edge attributes are copied to the result. If an attribute is present in
multiple graphs and would result a name clash, then this attribute is
renamed by adding suffixes: _1, _2, etc.
name vertex attribute is treated specially if the operation is
performed based on symbolic vertex names. In this case
name must be
present in all graphs, and it is not renamed in the result graph.
An error is generated if some input graphs are directed and others are undirected.
Other functions for manipulating graph structure:
Gabor Csardi firstname.lastname@example.org
## Union of two social networks with overlapping sets of actors net1 <- graph_from_literal( D - A:B:F:G, A - C - F - A, B - E - G - B, A - B, F - G, H - F:G, H - I - J ) net2 <- graph_from_literal(D - A:F:Y, B - A - X - F - H - Z, F - Y) print_all(net1 %u% net2) #> IGRAPH b6fc210 UN-- 13 21 -- #> + attr: name (v/c) #> + vertex attributes: #> | name #> |  D #> |  A #> |  B #> |  F #> |  G #> |  C #> |  E #> |  H #> |  I #> |  J #> |  Y #> |  X #> |  Z #> + edges from b6fc210 (vertex names): #>  I--J H--Z H--I G--H G--E F--X F--Y F--H F--C F--G B--E B--G A--X A--C A--F #>  A--B D--Y D--G D--F D--B D--A