private Graph CreateTestTreeGraph() { var vertexA = new Vertex("a"); var vertexB = new Vertex("b"); var vertexC = new Vertex("c"); var vertexD = new Vertex("d"); var vertexE = new Vertex("e"); var vertexF = new Vertex("f"); var vertexG = new Vertex("g"); var graph = new Graph(); graph.SetVertex(vertexA); graph.SetVertex(vertexB); graph.SetVertex(vertexC); graph.SetVertex(vertexD); graph.SetVertex(vertexE); graph.SetVertex(vertexF); graph.SetEdge(new Edge(vertexA, vertexB, 0)); graph.SetEdge(new Edge(vertexA, vertexC, 0)); graph.SetEdge(new Edge(vertexB, vertexD, 0)); graph.SetEdge(new Edge(vertexB, vertexE, 0)); graph.SetEdge(new Edge(vertexC, vertexF, 0)); graph.SetEdge(new Edge(vertexC, vertexG, 0)); return graph; }
private Graph CreateTestWeightedGraph() { var vertexA = new Vertex("A"); var vertexB = new Vertex("B"); var vertexC = new Vertex("C"); var vertexD = new Vertex("D"); var vertexE = new Vertex("E"); var vertexF = new Vertex("F"); var vertexG = new Vertex("G"); var vertexH = new Vertex("H"); var vertexI = new Vertex("I"); var vertexJ = new Vertex("J"); var graph = new Graph(); graph.SetVertex(vertexA); graph.SetVertex(vertexB); graph.SetVertex(vertexC); graph.SetVertex(vertexD); graph.SetVertex(vertexE); graph.SetVertex(vertexF); graph.SetVertex(vertexG); graph.SetVertex(vertexH); graph.SetVertex(vertexI); graph.SetVertex(vertexJ); graph.SetEdge(new Edge(vertexA, vertexB, 3)); graph.SetEdge(new Edge(vertexA, vertexF, 2)); graph.SetEdge(new Edge(vertexB, vertexC, 17)); graph.SetEdge(new Edge(vertexB, vertexD, 16)); graph.SetEdge(new Edge(vertexC, vertexD, 8)); graph.SetEdge(new Edge(vertexC, vertexI, 18)); graph.SetEdge(new Edge(vertexD, vertexE, 11)); graph.SetEdge(new Edge(vertexD, vertexI, 4)); graph.SetEdge(new Edge(vertexE, vertexF, 1)); graph.SetEdge(new Edge(vertexE, vertexG, 6)); graph.SetEdge(new Edge(vertexE, vertexH, 5)); graph.SetEdge(new Edge(vertexE, vertexI, 10)); graph.SetEdge(new Edge(vertexF, vertexG, 7)); graph.SetEdge(new Edge(vertexG, vertexH, 15)); graph.SetEdge(new Edge(vertexH, vertexI, 12)); graph.SetEdge(new Edge(vertexH, vertexJ, 13)); graph.SetEdge(new Edge(vertexI, vertexJ, 9)); graph.SetEdge(new Edge(vertexB, vertexA, 3)); graph.SetEdge(new Edge(vertexF, vertexA, 2)); graph.SetEdge(new Edge(vertexC, vertexB, 17)); graph.SetEdge(new Edge(vertexD, vertexB, 16)); graph.SetEdge(new Edge(vertexD, vertexC, 8)); graph.SetEdge(new Edge(vertexI, vertexC, 18)); graph.SetEdge(new Edge(vertexE, vertexD, 11)); graph.SetEdge(new Edge(vertexI, vertexD, 4)); graph.SetEdge(new Edge(vertexF, vertexE, 1)); graph.SetEdge(new Edge(vertexG, vertexE, 6)); graph.SetEdge(new Edge(vertexH, vertexE, 5)); graph.SetEdge(new Edge(vertexI, vertexE, 10)); graph.SetEdge(new Edge(vertexG, vertexF, 7)); graph.SetEdge(new Edge(vertexH, vertexG, 15)); graph.SetEdge(new Edge(vertexI, vertexH, 12)); graph.SetEdge(new Edge(vertexJ, vertexH, 13)); graph.SetEdge(new Edge(vertexJ, vertexI, 9)); return graph; }
private Graph CreateTestDirectlyAcyclicGraph() { var graph = new Graph(); for (int i = 0; i < 9; i++) { graph.SetVertex(new Vertex(i.ToString())); } graph.SetEdge(new Edge(graph["0"], graph["1"], 0)); graph.SetEdge(new Edge(graph["1"], graph["2"], 0)); graph.SetEdge(new Edge(graph["1"], graph["3"], 0)); graph.SetEdge(new Edge(graph["2"], graph["3"], 0)); graph.SetEdge(new Edge(graph["4"], graph["2"], 0)); graph.SetEdge(new Edge(graph["4"], graph["5"], 0)); graph.SetEdge(new Edge(graph["6"], graph["7"], 0)); graph.SetEdge(new Edge(graph["7"], graph["8"], 0)); graph.SetEdge(new Edge(graph["6"], graph["4"], 0)); return graph; }