Consistent tools for graph analysis#
NNGT provides several functions for topological analysis that return consistent results for all backends (the results will always be the same regardless of which library is used under the hood). This section describes these functions and gives an overview of the currently supported methods.
Note
It is of course possible to use any function from the library on the
graph
attribute; however, not using one of the
supported NNGT functions below will usually return results that are not
consistent between libraries (and the code will obviously no longer be
portable).
Supported functions#
The following table details which functions are supported for directed and undirected networks, and whether they also work with weighted edges.
The test file where these functions are checked can be found here: testing/library_compatibility.py.
For each type of graph, the table tells which libraries are supported for the given function (graphtool is gt, networkx is nx and igraph is ig). Custom implementation of a function is denoted by nngt, meaning that the function can be used even if no graph library is installed. A library marked between parentheses denotes partial support and additional explanation is usually given in the footnotes. A cross means that no consistent implementation is currently provided and the function will raise an error if one tries to use it on such graphs. Methods that are not defined for weighted or directed graphs are marked by NA.
Method 
Unweighted undirected 
Unweighted directed 
Weighted undirected 
Weighted directed 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

gt, nx, ig 
gt, nx, ig 
gt, ig 
gt, ig 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

gt, nx, ig, nngt 
gt, nx, ig, nngt 
gt, nx, ig, nngt 
gt, nx, ig, nngt 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

gt, nx, ig, nngt 
nngt 
nngt 
nngt 

gt, nx, ig, nngt 
nngt 
nngt 
nngt 

gt, nx, ig, nngt 
gt, nx, ig, nngt 
NA 
NA 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

gt, nx, ig 
gt, nx, ig 
gt, nx, ig 
gt, nx, ig 

nngt 
nngt 
nngt 
nngt 

nngt 
nngt 
nngt 
nngt 

gt, nx, ig, nngt 
nngt 
nngt 
nngt 
Clustering in weighted and directed networks#
For directed clustering, NNGT provides the total clustering proposed in [Fagiolo2007]
with is the reciprocal degree.
For undirected weighted clustering, NNGT provides the definition proposed in [Barrat2004], [Onnela2005], [Zhang2005] as well as a new continuous definition [Fardet2021].
with the generalized strength associated to the matrix .
For directed weighted clustering, the generalization of Barrat from [Clemente2018] is provided, as well as a generalization of Onnela, Zhang–Horvath, and of the continuous clustering [Fardet2020], for all four directed modes (middleman, cycle, fanin, and fanout), as well as their sum, the total clustering:
with the total strength and the arithmetic reciprocal strength,
with the total generalized strength and the geometric reciprocal strength.
Global clusterings are defined as the sum of all numerators divided by the sum of all denominators for all definitions.
References#
Barrat, Barthelemy, PastorSatorras, Vespignani. The Architecture of Complex Weighted Networks. PNAS 2004, 101 (11). DOI: 10.1073/pnas.0400087101.
Clemente, Grassi. Directed Clustering in Weighted Networks: A New Perspective. Chaos, Solitons & Fractals 2018, 107, 26–38. DOI: 10.1016/j.chaos.2017.12.007, arXiv: 1706.07322.
Fagiolo. Clustering in Complex Directed Networks. Phys. Rev. E 2007, 76, (2), 026107. DOI: 10.1103/PhysRevE.76.026107, arXiv: physics/0612169.
Onnela, Saramäki, Kertész, Kaski. Intensity and Coherence of Motifs in Weighted Complex Networks. Phys. Rev. E 2005, 71 (6), 065103. DOI: 10.1103/physreve.71.065103, arXiv: condmat/0408629.
Saramäki, Kivelä, Onnela, Kaski, Kertész. Generalizations of the Clustering Coefficient to Weighted Complex Networks. Phys. Rev. E 2007, 75 (2), 027105. DOI: 10.1103/PhysRevE.75.027105, arXiv: condmat/0608670.
Zhang, Horvath. A General Framework for Weighted Gene CoExpression Network Analysis. Statistical Applications in Genetics and Molecular Biology 2005, 4 (1). DOI: 10.2202/15446115.1128, PDF.
Fardet, Levina. Weighted directed clustering: interpretations and requirements for heterogeneous, inferred, and measured networks. 2021. arXiv: 2105.06318.
Go to other tutorials: