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.
G (NetworkX DiGraph) – A directed acyclic graph (DAG)
The transitive reduction of
- Return type
NetworkXError – If
Gis not a directed acyclic graph (DAG) transitive reduction is not uniquely defined and a
NetworkXErrorexception is raised.