NetworkX

Previous topic

kosaraju_strongly_connected_components

Next topic

is_weakly_connected

condensation

condensation(G, scc=None)[source]

Returns the condensation of G.

The condensation of G is the graph with each of the strongly connected components contracted into a single node.

Parameters :

G : NetworkX DiGraph

A directed graph.

scc: list (optional, default=None) :

A list of strongly connected components. If provided, the elements in scc must partition the nodes in G. If not provided, it will be calculated as scc=nx.strongly_connected_components(G).

Returns :

C : NetworkX DiGraph

The condensation of G. The node labels are integers corresponding to the index of the component in the list of strongly connected components.

Raises :

NetworkXError: If G is not directed :

Notes

After contracting all strongly connected components to a single node, the resulting graph is a directed acyclic graph.