Minimum Spanning Tree
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
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0.0 |
