Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.tree.branchings.maximum_spanning_arborescence

maximum_spanning_arborescence(G, attr='weight', default=1)[source]

Returns a maximum spanning arborescence from G.

Parameters:
  • G ((multi)digraph-like) – The graph to be searched.
  • attr (str) – The edge attribute used to in determining optimality.
  • default (float) – The value of the edge attribute used if an edge does not have the attribute attr.
Returns:

B – A maximum spanning arborescence.

Return type:

(multi)digraph-like

Raises:

NetworkXException – If the graph does not contain a maximum spanning arborescence.