networkx.algorithms.tree.branchings.minimum_spanning_arborescence¶
-
minimum_spanning_arborescence(G, attr='weight', default=1, preserve_attrs=False)[source]¶ Returns a minimum 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 attributeattr.preserve_attrs (
bool) – If True, preserve the other attributes of the original graph (that are not passed toattr)
- Returns
B – A minimum spanning arborescence.
- Return type
(multi)digraph-like- Raises
NetworkXException – If the graph does not contain a minimum spanning arborescence.