GetClustCf¶

Note

Note

This function is not yet supported.

Computes the average clustering coefficient, as well as the number of open and closed triads in the graph, as defined in Watts and Strogatz, Collective dynamics of ‘small-world’ networks.

Parameters:

• Graph: graph (input)

A Snap.py graph or a network

• DegToCCfV: a vector of pairs of floats (output)

The vector of pairs (degree, avg. clustering coefficient of nodes of that degree)

The closed triads in the graph

The open triads in the graph

• SampleNodes: int (input)

If !=-1 then compute clustering coefficient only for a random sample of SampleNodes nodes

Return value:

• float

The average clustering coefficient

The following example shows how to compute the in degree for nodes in TNGraph, TUNGraph, and TNEANet:

```import snap

Graph = snap.GenRndGnm(snap.PNGraph, 100, 1000)
DegToCCfV = snap.TFltPrV()
# There is no SNAP type for 64-bit ints, so use two argument version of function instead
print snap.GetClustCf(Graph, DegToCCfV)
for item in DegToCCfV:
print item.GetVal1(), item.GetVal2()

Graph = snap.GenRndGnm(snap.PUNGraph, 100, 1000)
DegToCCfV = snap.TFltPrV()
# There is no SNAP type for 64-bit ints, so use two argument version of function instead
print snap.GetClustCf(Graph, DegToCCfV)
for item in DegToCCfV:
print item.GetVal1(), item.GetVal2()

Graph = snap.GenRndGnm(snap.PNEANet, 100, 1000)
DegToCCfV = snap.TFltPrV()
# There is no SNAP type for 64-bit ints, so use two argument version of function instead
print snap.GetClustCf(Graph, DegToCCfV)
for item in DegToCCfV:
print item.GetVal1(), item.GetVal2()
```

GetClustCf