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)

Returns the graph complement of G.

reverse(G[, copy])

Returns the reverse directed graph of G.

Operations on graphs including union, intersection, difference.

compose(G, H)

Returns 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)

Returns a new graph that contains only the edges that exist in both G and H.

difference(G, H)

Returns a new graph that contains the edges that exist in G but not in H.

symmetric_difference(G, H)

Returns new graph with edges that exist in either G or H but not both.

full_join(G, H[, rename])

Returns the full join of graphs G and H.

Operations on many graphs.

compose_all(graphs)

Returns the composition of all graphs.

union_all(graphs[, rename])

Returns the union of all graphs.

disjoint_union_all(graphs)

Returns the disjoint union of all graphs.

intersection_all(graphs)

Returns a new graph that contains only the edges that exist in all graphs.

Graph products.

cartesian_product(G, H)

Returns the Cartesian product of G and H.

lexicographic_product(G, H)

Returns the lexicographic product of G and H.

rooted_product(G, H, root)

Return the rooted product of graphs G and H rooted at root in H.

strong_product(G, H)

Returns the strong product of G and H.

tensor_product(G, H)

Returns the tensor product of G and H.

power(G, k)

Returns the specified power of a graph.