Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

OperatorsΒΆ

Unary operations on graphs

complement(G[, name]) Return the graph complement of G.
reverse(G[, copy]) Return the reverse directed graph of G.

Operations on graphs including union, intersection, difference.

compose(G, H[, name]) Return a new graph of G composed with H.
union(G, H[, rename, name]) Return the union of graphs G and H.
disjoint_union(G, H) Return the disjoint union of graphs G and H.
intersection(G, H) Return a new graph that contains only the edges that exist in both G and H.
difference(G, H) Return a new graph that contains the edges that exist in G but not in H.
symmetric_difference(G, H) Return new graph with edges that exist in either G or H but not both.

Operations on many graphs.

compose_all(graphs[, name]) Return the composition of all graphs.
union_all(graphs[, rename, name]) Return the union of all graphs.
disjoint_union_all(graphs) Return the disjoint union of all graphs.
intersection_all(graphs) Return a new graph that contains only the edges that exist in all graphs.

Graph products.

cartesian_product(G, H) Return the Cartesian product of G and H.
lexicographic_product(G, H) Return the lexicographic product of G and H.
strong_product(G, H) Return the strong product of G and H.
tensor_product(G, H) Return the tensor product of G and H.
power(G, k) Returns the specified power of a graph.