Note
This documents the development version of NetworkX. Documentation for the current release can be found here.
networkx.algorithms.triads.triadic_census¶

triadic_census
(G, nodelist=None)[source]¶ Determines the triadic census of a directed graph.
The triadic census is a count of how many of the 16 possible types of triads are present in a directed graph. If a list of nodes is passed, then only those triads are taken into account which have elements of nodelist in them.
 Parameters
 Gdigraph
A NetworkX DiGraph
 nodelistlist
List of nodes for which you want to calculate triadic census
 Returns
 censusdict
Dictionary with triad type as keys and number of occurrences as values.
See also
triad_graph
Notes
This algorithm has complexity \(O(m)\) where \(m\) is the number of edges in the graph.
References
 1
Vladimir Batagelj and Andrej Mrvar, A subquadratic triad census algorithm for large sparse networks with small maximum degree, University of Ljubljana, http://vlado.fmf.unilj.si/pub/networks/doc/triads/triads.pdf