networkx.algorithms.tree.branchings.maximum_spanning_arborescence¶
- maximum_spanning_arborescence(G, attr='weight', default=1, preserve_attrs=False)[source]¶
Returns a maximum spanning arborescence from G.
- Parameters
- G(multi)digraph-like
The graph to be searched.
- attrstr
The edge attribute used to in determining optimality.
- defaultfloat
The value of the edge attribute used if an edge does not have the attribute
attr
.- preserve_attrsbool
If True, preserve the other attributes of the original graph (that are not passed to
attr
)
- Returns
- B(multi)digraph-like
A maximum spanning arborescence.
- Raises
- NetworkXException
If the graph does not contain a maximum spanning arborescence.