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.
- 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)