public static void Main(string[] args) { GraphAM graph = new GraphAM(4); graph.addUndirectedEdge(0, 1, 1); graph.addUndirectedEdge(0, 2, 1); graph.addUndirectedEdge(1, 2, 1); graph.addUndirectedEdge(2, 3, 1); graph.print(); }
public static void main41(string[] args) { GraphAM gph = new GraphAM(9); gph.addUndirectedEdge(0, 2, 1); gph.addUndirectedEdge(1, 2, 5); gph.addUndirectedEdge(1, 3, 7); gph.addUndirectedEdge(1, 4, 9); gph.addUndirectedEdge(3, 2, 2); gph.addUndirectedEdge(3, 5, 4); gph.addUndirectedEdge(4, 5, 6); gph.addUndirectedEdge(4, 6, 3); gph.addUndirectedEdge(5, 7, 1); gph.addUndirectedEdge(6, 7, 7); gph.addUndirectedEdge(7, 8, 17); gph.print(); prims(gph); dijkstra(gph, 1); }
public static void main40(string[] args) { GraphAM gph = new GraphAM(9); gph.addUndirectedEdge(0, 1, 4); gph.addUndirectedEdge(0, 7, 8); gph.addUndirectedEdge(1, 2, 8); gph.addUndirectedEdge(1, 7, 11); gph.addUndirectedEdge(2, 3, 7); gph.addUndirectedEdge(2, 8, 2); gph.addUndirectedEdge(2, 5, 4); gph.addUndirectedEdge(3, 4, 9); gph.addUndirectedEdge(3, 5, 14); gph.addUndirectedEdge(4, 5, 10); gph.addUndirectedEdge(5, 6, 2); gph.addUndirectedEdge(6, 7, 1); gph.addUndirectedEdge(6, 8, 6); gph.addUndirectedEdge(7, 8, 7); gph.print(); prims(gph); dijkstra(gph, 0); }