networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturns
condensation(G, scc=None)

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

Notes

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

Parameters

G : NetworkX DiGraph

A directed graph.

scc: list or generator (optional, default=None) :

Strongly connected components. If provided, the elements in :None:None:`scc` must partition the nodes in G. If not provided, it will be calculated as scc=nx.strongly_connected_components(G).

Raises

NetworkXNotImplemented

If G is undirected.

Returns

C : NetworkX DiGraph

The condensation graph C of G. The node labels are integers corresponding to the index of the component in the list of strongly connected components of G. C has a graph attribute named 'mapping' with a dictionary mapping the original nodes to the nodes in C to which they belong. Each node in C also has a node attribute 'members' with the set of original nodes in G that form the SCC that the node in C represents.

Returns the condensation of G.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/components/strongly_connected.py#356
type: <class 'function'>
Commit: