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


compose(G, H, name=None)[source]

Return a new graph of G composed with H.

Composition is the simple union of the node sets and edge sets. The node sets of G and H need not be disjoint.


G,H : graph

A NetworkX graph

name : string

Specify name for new graph


C: A new graph with the same type as G


It is recommended that G and H be either both directed or both undirected. Attributes from H take precedent over attributes from G.