GraphTheory[GraphUnion]
|
Calling Sequence
|
|
GraphUnion(G1,...,Gs)
|
|
Description
|
|
•
|
The GraphUnion(G1,G2) function returns a graph G with Vertices(G) = Vertices(G1) union Vertices(G2) and Edges(G) = Edges(G1) union Edges(G2). Moreover, if G1 and G2 are both weighted graphs, the resulting graph is a weighted graph where the weight of any common edge is the sum of the weights of that edge in G1 and G2.
|
•
|
Note that G1 and G2 must both be directed, or both be undirected, and then the resulting graph is directed or undirected, respectively. Likewise, G1 and G2 must both be weighted, or both unweighted, and the resulting graph is then weighted or unweighted, respectively.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
In this example, note that the vertices of G1 and G2 are permuted differently.
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
In this example, note that there is one common vertex between the two graphs
>
|
|
| (12) |
>
|
|
| (13) |
>
|
|
| (14) |
>
|
|
| (15) |
>
|
|
| (16) |
|
|
Download Help Document
Was this information helpful?