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



Returns the disjoint union of all graphs.

This operation forces distinct integer node labels starting with 0 for the first graph in the list and numbering consecutively.

Parameters:graphs (list) – List of NetworkX graphs
Return type:A graph with the same type as the first graph in list
Raises:ValueError – If graphs is an empty list.


It is recommended that the graphs be either all directed or all undirected.

Graph, edge, and node attributes are propagated to the union graph. If a graph attribute is present in multiple graphs, then the value from the last graph in the list with that attribute is used.