GetSccSzCnt

GetSccSzCnt()

A graph method that returns a distribution of strongly connected component sizes.

Parameters:

  • None

Return Value:

  • SccSzCnt: TIntPrV, a vector of (int, int) pairs

    Vector of pairs (number of nodes in the component, number of such components).

The following example shows how to get the distribution of strongly-connected component sizes in TNGraph, TUNGraph, and TNEANet:

import snap

Graph = snap.GenRndGnm(snap.TNGraph, 100, 1000)
ComponentDist = Graph.GetSccSzCnt()
for comp in ComponentDist:
    print("Size: %d - Number of Components: %d" % (comp.GetVal1(), comp.GetVal2()))

UGraph = snap.GenRndGnm(snap.TUNGraph, 100, 1000)
ComponentDist = UGraph.GetSccSzCnt()
for comp in ComponentDist:
    print("Size: %d - Number of Components: %d" % (comp.GetVal1(), comp.GetVal2()))

Network = snap.GenRndGnm(snap.TNEANet, 100, 1000)
ComponentDist = Network.GetSccSzCnt()
for comp in ComponentDist:
    print("Size: %d - Number of Components: %d" % (comp.GetVal1(), comp.GetVal2()))