transitive_reduction¶
-
transitive_reduction
(G)[source]¶ Returns transitive reduction of a directed graph
The transitive reduction of G = (V,E) is a graph G- = (V,E-) such that for all v,w in V there is an edge (v,w) in E- if and only if (v,w) is in E and there is no path from v to w in G with length greater than 1.
Parameters: G (NetworkX DiGraph) – Graph Returns: TR – Graph Return type: NetworkX DiGraph Raises: NetworkXError
– If G is not a directed acyclic graph (DAG) transitive reduction is not uniquely defined and a NetworkXError exception is raised.References