Generates an Erdos-Renyi random graph of the specified GraphType.
Parameters:
Class of output graph – one of PNGraph, PNEANet, or PUNGraph.
Number of nodes in the generated graph.
Number of edges in the genereated graph.
Indicates whether to consider the edges as directed or undirected. Defaults to directed.
Random number generator.
Return value:
A Snap.py graph of the specified type.
The following example shows how to generate random graphs of types TNGraph, TUNGraph, and TNEANet:
import snap
Graph = snap.GenRndGnm(snap.PNGraph, 100, 1000)
for EI in Graph.Edges():
print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())
UGraph = snap.GenRndGnm(snap.PUNGraph, 100, 1000)
for EI in UGraph.Edges():
print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())
Network = snap.GenRndGnm(snap.PNEANet, 100, 1000)
for EI in Network.Edges():
print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())