Please, help me to understand how to get minimal spanning tree from adjacency matrix of graph! I write coursework about it in java, deadline is 16.12.2010, but I feel that it shall be fail. Now my program can:
- Draw nodes
- Draw edges
- Generate adjacency matrix of graph on basement of your drawing with weight of edges
- Find minimal edge connected to node
- and have some other testing / tested features
But I don't know how realize Prim / Kruskal algorhythm in Java. I try to find some resolves in google, but find only Java-applet, that needs to work .obj files, also I can't run it.
I write some Simple console java pattern that now generate and print adjacency matrix of graph. Can anybody add function that returns adjacency matrix of minimal spanning tree of graph looking like:
public static int[][] mst(int[][] graph, int n) {
...
}
where:
- graph - is generated graph in n
- amount of vertexes (nodes)
Thanks in advance!