GetNodeInDegV

GetNodeInDegV()

A graph method that returns the in-degree for every node.

Parameters:

  • None

Return value:

  • NIdInDegV: TIntPrV, a vector or (int, int) pairs

    A vector of (node id, node in-degree) pairs.

The following example shows how to use GetNodeInDegV() with nodes in TNGraph, TUNGraph, and TNEANet:

import snap

Graph = snap.GenRndGnm(snap.TNGraph, 100, 1000)
InDegV = Graph.GetNodeInDegV()
for item in InDegV:
    print("node ID %d: in-degree %d" % (item.GetVal1(), item.GetVal2()))

UGraph = snap.GenRndGnm(snap.TUNGraph, 100, 1000)
InDegV = UGraph.GetNodeInDegV()
for item in InDegV:
    print("node ID %d: in-degree %d" % (item.GetVal1(), item.GetVal2()))

Network = snap.GenRndGnm(snap.TNEANet, 100, 1000)
InDegV = Network.GetNodeInDegV()
for item in InDegV:
    print("node ID %d: in-degree %d" % (item.GetVal1(), item.GetVal2()))