GenFull(GraphType, Nodes)

Generates a complete graph on Nodes nodes. Graph has no self-loops.


  • GraphType: graph class (input)

    Class of output graph – one of PNGraph, PNEANet, or PUNGraph.

  • Nodes: int (input)

    The number of nodes used to generate the graph.

Return value:

  • graph

    A graph of the specified type.

The following example shows how to generate different types of fully connected graphs for classes TNGraph, TUNGraph, and TNEANet:

import snap

Graph = snap.GenFull(snap.PNGraph, 5)
for EI in Graph.Edges():
    print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())

UGraph = snap.GenFull(snap.PUNGraph, 5)
for EI in UGraph.Edges():
    print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())

Network = snap.GenFull(snap.PNEANet, 5)
for EI in Network.Edges():
    print "edge: (%d, %d)" % (EI.GetSrcNId(), EI.GetDstNId())

Previous topic

Graph Generators

Next topic


This Page