Generates a tree graph of Levels levels with every parent having Fanout children.
Parameters:
Class of output graph – one of PNGraph, PNEANet, or PUNGraph.
Number of children of each parent node.
Number of levels of the tree.
Indicates whether the edges should be directed or undirected. Defaults to directed.
True if children should point to their parents. Only applies to directed graphs.
Return Value:
A Snap.py graph of the specified type.
The following examples shows how to generate a tree graph for classes TNGraph, TUNGraph, and TNEANet:
import snap
Graph = snap.GenTree(snap.PNGraph, 3, 3)
for EI in Graph.Edges():
print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())
UGraph = snap.GenTree(snap.PUNGraph, 3, 3)
for EI in UGraph.Edges():
print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())
Network = snap.GenTree(snap.PNEANet, 3, 3)
for EI in Network.Edges():
print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())