Note
This page is a draft and under revision.
Note
This function is not yet supported.
Computes the number of open and closed triads for every node in Graph. Considers the graph as undirected.
Parameters:
A Snap.py graph or a network
Triple (node id, open triads: number of pairs of node’s neighbors that are not connected, closed triads: number of pairs of node’s neighbors that are connected between themselves).
If !=-1 then compute triads only for a random sample of SampleNodes nodes. Useful for approximate but quick computations.
Return value:
The following example shows how to compute the number of open and closed triads for nodes in TNGraph, TUNGraph, and TNEANet:
import snap
Graph = snap.GenRndGnm(snap.PNGraph, 100, 1000)
TriadV = snap.TIntTrV()
snap.GetTriads(Graph, TriadV)
for triple in TriadV:
print triple.Val1(), triple.Val2(), triple.Val3()
Graph = snap.GenRndGnm(snap.PUNGraph, 100, 1000)
TriadV = snap.TIntTrV()
snap.GetTriads(Graph, TriadV)
for triple in TriadV:
print triple.Val1(), triple.Val2(), triple.Val3()
Graph = snap.GenRndGnm(snap.PNEANet, 100, 1000)
TriadV = snap.TIntTrV()
snap.GetTriads(Graph, TriadV)
for triple in TriadV:
print triple.Val1(), triple.Val2(), triple.Val3()