Ejemplo n.º 1
0
        private static Graph GetSimpleDAG()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("A B");
            sb.AppendLine("B C");
            string graphString = sb.ToString();

            Graph g = KevinGraph.FromString(graphString);

            Assert.AreEqual(g.NumVertices, 3);
            return(g);
        }
Ejemplo n.º 2
0
        private static Graph GetComplexDAG()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("A C");
            sb.AppendLine("B C");
            sb.AppendLine("B D");
            sb.AppendLine("D E");
            sb.AppendLine("E F");
            sb.AppendLine("G E");
            string graphString = sb.ToString();

            Graph g = KevinGraph.FromString(graphString);

            Assert.AreEqual(g.NumVertices, 7);
            return(g);
        }
Ejemplo n.º 3
0
        private static Graph GetTestUnweightedGraph()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("A B C");
            sb.AppendLine("B A D G");
            sb.AppendLine("C A E");
            sb.AppendLine("D B E F");
            sb.AppendLine("E C D F H");
            sb.AppendLine("F E D");
            sb.AppendLine("G B");
            sb.AppendLine("H E I J");
            sb.AppendLine("I H");
            sb.AppendLine("J H");
            string graphString = sb.ToString();

            Graph g = KevinGraph.FromString(graphString);

            Assert.AreEqual(g.NumVertices, 10);
            return(g);
        }
Ejemplo n.º 4
0
        private static Graph GetTestWeightedGraph()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("A B(w:5) C(w:1)");
            //sb.AppendLine("B A(w:5) D(w:8) G(w:3)");  // shortest path:  GBDF
            sb.AppendLine("B A(w:5) D(w:12) G(w:3)");               // shortest path:  G B A C E F
            sb.AppendLine("C A(w:1) E(w:2)");
            //sb.AppendLine("D B(w:8) E(w:3) F(w:5)");  // shortest path:  GBDF
            sb.AppendLine("D B(w:12) E(w:3) F(w:5)");               // shortest path:  G B A C E F
            sb.AppendLine("E C(w:2) D(w:3) F(w:6) H(w:7)");
            sb.AppendLine("F E(w:6) D(w:5)");
            sb.AppendLine("G B(w:3)");
            sb.AppendLine("H E(w:7) I(w:3) J(w:8)");
            sb.AppendLine("I H(w:3)");
            sb.AppendLine("J H(w:8)");
            string graphString = sb.ToString();

            Graph g = KevinGraph.FromString(graphString);

            Assert.AreEqual(g.NumVertices, 10);
            return(g);
        }