Uses the entire graph (all edges) to measure the shortest path lengths but reports only the path lengths between nodes in SubGraphNIdV.
Parameters:
A Snap.py graph or a network.
Number of starting nodes for calculating path lengths.
List of nodes in the subgraph for which the path lengths will be reported.
Indicates whether the edges should be considered directed or undirected.
Return value:
The list contains three elements: the first and the second element are the 90th-percentile approximation for the average shortest path length among the nodes in SubGraphNIdV, the third element is the diameter.
Notes:
The following example shows how to calculate the average shortest path length for nodes in TNGraph, TUNGraph, and TNEANet:
import snap
Graph = snap.GenRndGnm(snap.PNGraph, 100, 1000)
Num = 50
List = snap.TIntV.GetV(1, 4, 9, 16, 25, 36)
Result = snap.GetBfsEffDiam(Graph, Num, List, True)
print Result
Graph = snap.GenRndGnm(snap.PUNGraph, 100, 1000)
Num = 75
List = snap.TIntV.GetV(1, 4, 9, 16, 25, 36)
Result = snap.GetBfsEffDiam(Graph, Num, List, False)
print Result
Graph = snap.GenRndGnm(snap.PNEANet, 100, 1000)
Num = 33
List = snap.TIntV.GetV(1, 4, 9, 16, 25, 36)
Result = snap.GetBfsEffDiam(Graph, Num, List, True)
print Result