# networkx.algorithms.cycles.minimum_cycle_basis¶

minimum_cycle_basis(G, weight=None)[source]

Returns a minimum weight cycle basis for G

Minimum weight means a cycle basis for which the total weight (length for unweighted graphs) of all the cycles is minimum.

Parameters
• G (NetworkX Graph)

• weight (string) – name of the edge attribute to use for edge weights

Returns

• A list of cycle lists. Each cycle list is a list of nodes

• which forms a cycle (loop) in G. Note that the nodes are not

• necessarily returned in a order by which they appear in the cycle

Examples

>>> G=nx.Graph()