Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find the minimal spanning tree for a given set of points in Euclidean space
ResourceFunction["KruskalAlgorithm"][pts] finds the minimal spanning tree for pts. | |
ResourceFunction["KruskalAlgorithm"][pts,"Graph"] shows the minimal spanning tree for pts as a Graph. |
Return a minimal spanning tree for a given set of points:
| In[1]:= |
| In[2]:= |
| Out[2]= |
The minimal spanning tree is not necessarily unique:
| In[4]:= |
| Out[4]= | ![]() |
Show a minimum spanning tree for a square lattice grid:
| In[5]:= |
| Out[5]= | ![]() |
Show a minimum spanning tree for a regular grid in three dimensions:
| In[6]:= |
| Out[6]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License