cugraph.tree.minimum_spanning_tree.minimum_spanning_tree#
- cugraph.tree.minimum_spanning_tree.minimum_spanning_tree(G, weight=None, algorithm='boruvka', ignore_nan=False)[source]#
Returns a minimum spanning tree (MST) or forest (MSF) on an undirected graph
- Parameters:
- GcuGraph.Graph or networkx.Graph
cuGraph graph descriptor with connectivity information.
Deprecated since version 24.12: Accepting a
networkx.Graph
is deprecated and will be removed in a future version. Fornetworkx.Graph
use networkx directly with thenx-cugraph
backend. See: https://rapids.ai/nx-cugraph/- weightstring
default to the weights in the graph, if the graph edges do not have a weight attribute a default weight of 1 will be used.
- algorithmstring
Default to ‘boruvka’. The parallel algorithm to use when finding a minimum spanning tree.
- ignore_nanbool
Default to False
- Returns:
- G_mstcuGraph.Graph or networkx.Graph
A graph descriptor with a minimum spanning tree or forest. The networkx graph will not have all attributes copied over
Examples
>>> from cugraph.datasets import netscience >>> G = netscience.get_graph(download=True) >>> G_mst = cugraph.minimum_spanning_tree(G)