Note
This page is a draft and under revision.
Note
This function is not yet supported.
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.
90-th percentile approximation of the diameter of SubGraphNIdV, equal to the average shortest path length.
The maximal shortest path found from the sampled nodes, used to approximate the full diameter of the graph.
Return value:
90th-percentile approximation for the average shortest path length among the nodes in SubGraphNIdV.
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)
Dist = snap.GetBfsEffDiam(Graph, Num, List, True,0,0)
print Dist
Graph = snap.GenRndGnm(snap.PUNGraph, 100, 1000)
Num = 75
List = snap.TIntV.GetV(1, 4, 9, 16, 25, 36)
Dist = snap.GetBfsEffDiam(Graph, Num, List, False,0,0)
print Dist
Graph = snap.GenRndGnm(snap.PNEANet, 100, 1000)
Num = 33
List = snap.TIntV.GetV(1, 4, 9, 16, 25, 36)
Dist = snap.GetBfsEffDiam(Graph, Num, List, True,0,0)
print Dist