union method

Graph<V, E> union(
  1. Graph<V, E> other, {
  2. E edgeMerge(
    1. V source,
    2. V target,
    3. E a,
    4. E b,
    )?,
})

Returns the union of this graph and other. This is a graph with the nodes and edges present in either of the two graphs. edgeMerge specifies how parallel edges are merged, if unspecified the last one is used.

Implementation

Graph<V, E> union(Graph<V, E> other,
    {E Function(V source, V target, E a, E b)? edgeMerge}) {
  final result = copy(empty: true);
  unionAll<V, E>(result, [this, other], edgeMerge: edgeMerge);
  return result;
}