Minimum Spanning Tree

Implementation of Prim algorithm to solve Minimum Spanning Tree (MST)
325 download
Aggiornato 3 mar 2019

Visualizza la licenza

The input Matrix is edge-weighted matirx with not connected edge assigned as 0
>>A =
[0 192 344 0 0 0 0 0 0 0 0;
192 0 309 0 555 0 0 0 0 0 0;
344 309 0 499 0 0 0 0 0 0 0;
0 0 499 0 840 0 229 286 0 0 0;
0 555 0 840 0 237 0 0 0 0 0;
0 0 0 0 237 0 729 0 0 793 0;
0 0 0 229 0 729 0 383 0 0 0;
0 0 0 286 0 0 383 0 929 0 0;
0 0 0 0 0 0 0 929 0 934 581;
0 0 0 0 0 793 0 0 934 0 633;
0 0 0 0 0 0 0 0 581 633 0;]
>>route=prims(A,1)
1 2 192
2 3 309
3 4 499
4 7 229
4 8 286
2 5 555
5 6 237
6 10 793
10 11 633
11 9 581

Cita come

Ashim Gautam (2025). Minimum Spanning Tree (https://it.mathworks.com/matlabcentral/fileexchange/70454-minimum-spanning-tree), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2018b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Biological and Health Sciences in Help Center e MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0