Created
May 3, 2022 04:21
-
-
Save sausheong/6f4be760e0f270a36a91c52bf199e228 to your computer and use it in GitHub Desktop.
mst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func main() { | |
| graph := buildGraph() | |
| fmt.Println("GRAPH\n-----") | |
| nodes := sortNodes(graph.Nodes) | |
| for _, node := range nodes { | |
| fmt.Printf("%s -> %v\n", node.name, graph.Edges[node.name]) | |
| } | |
| fmt.Println() | |
| bMST := boruvka(graph) | |
| fmt.Println("BORUVSKA MINIMUM SPANNING TREE\n-----------------------------") | |
| nodes = sortNodes(bMST.Nodes) | |
| for _, node := range nodes { | |
| fmt.Printf("%s -> %v\n", node.name, bMST.Edges[node.name]) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment