Macaulay2 » Documentation
Packages » Graphs :: disjointUnion
next | previous | forward | backward | up | index | toc

# disjointUnion -- Returns the disjoint union of a list of graphs.

- Usage:
    `G = disjointUnion L`
- Inputs:
  - L, a list,
- Outputs:
  - G, a graph, The disjoint union of the graphs in list L

## Description

The disjoint union of a list of graphs is the graph constructed from the unions of their respective vertex sets and edge sets. By default, the vertex set of the union will be listed as sequences.

    i1 : A = graph({{1,2},{2,3}},EntryMode=>"edges");

    i2 : B = graph({1,2,3,4,5},{{1,2},{4,5}});

    i3 : disjointUnion {A,B}

    o3 = Graph{{1, 0} => {{2, 0}}        }
               {1, 1} => {{2, 1}}
               {2, 0} => {{1, 0}, {3, 0}}
               {2, 1} => {{1, 1}}
               {3, 0} => {{2, 0}}
               {3, 1} => {}
               {4, 1} => {{5, 1}}
               {5, 1} => {{4, 1}}

    o3 : Graph

## Ways to use disjointUnion:

- `disjointUnion(List)`

## For the programmer

The object disjointUnion is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Graphs.m2:4836:0.