minimum_cycle_basis(G, weight=None)
Minimum weight means a cycle basis for which the total weight (length for unweighted graphs) of all the cycles is minimum.
name of the edge attribute to use for edge weights
Returns a minimum weight cycle basis for G
>>> G = nx.Graph()
... nx.add_cycle(G, [0, 1, 2, 3])
... nx.add_cycle(G, [0, 3, 4, 5])
... print([sorted(c) for c in nx.minimum_cycle_basis(G)]) [[0, 1, 2, 3], [0, 3, 4, 5]]
References:
[1] Kavitha, Telikepalli, et al. "An O(m^2n) Algorithm for Minimum Cycle Basis of Graphs." http://link.springer.com/article/10.1007/s00453-007-9064-z [2] de Pina, J. 1995. Applications of shortest path methods. Ph.D. thesis, University of Amsterdam, Netherlands
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.cycles.minimum_cycle_basis
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them