示例#1
0
        public void TwoGraphWithDifferentIdSameTest()
        {
            Graph g1 = new Graph(1);
            Graph g2 = new Graph(2);

            Assert.IsFalse(g1.Equals(g2));
        }
示例#2
0
        public void TwoGraphWithSameIdSameTest()
        {
            Graph g1 = new Graph(1);
            Graph g2 = new Graph(1);

            Assert.IsTrue(g1.Equals(g2));
        }
示例#3
0
        public void TwoEmptyGraphSameTest()
        {
            Graph g1 = new Graph();
            Graph g2 = new Graph();

            Assert.IsTrue(g1.Equals(g2));
        }
示例#4
0
        public void TwoGraphWithSameNodeWithoutEdges()
        {
            Graph g1 = new Graph(1);
            Graph g2 = new Graph(2);

            Node n = new Node("n");

            g1.AddNode(n);
            g2.AddNode(n);

            Assert.IsFalse(g1.Equals(g2));
        }
示例#5
0
        public void TwoGraphWithEqualNodesWithoutEdges()
        {
            Graph g1 = new Graph(1);
            Graph g2 = new Graph(2);

            Node n1 = new Node("n");
            Node n2 = new Node("n");

            g1.AddNode(n1);
            g2.AddNode(n2);

            Assert.IsFalse(g1.Equals(g2));
        }
示例#6
0
        public void TwoGraphWithTwoEqualNodesWithoutEdges()
        {
            Graph g1 = new Graph(1);
            Graph g2 = new Graph(2);

            Node n1 = new Node("n1");
            Node n2 = new Node("n2");
            Node n3 = new Node("n3");
            Node n4 = new Node("n4");

            g1.AddNode(n1);
            g1.AddNode(n2);
            g2.AddNode(n3);
            g2.AddNode(n4);

            Assert.IsFalse(g1.Equals(g2));
        }
示例#7
0
        public void TwoGraphWithTwoNodeWithSingleEdge()
        {
            Graph g1 = new Graph(1);
            Graph g2 = new Graph(2);

            Node a = new Node("a");
            Node b = new Node("b");

            Edge ab = new Edge(1);

            g1.AddNode(a);
            g1.AddNode(b);
            g1.AddUndirectedEdge(new Tuple<Node, int>(a, 0), new Tuple<Node, int>(b, 0), ab);

            g2.AddNode(a);
            g2.AddNode(b);
            g2.AddUndirectedEdge(new Tuple<Node, int>(a, 0), new Tuple<Node, int>(b, 0), ab);

            Assert.IsFalse(g1.Equals(g2));
        }
示例#8
0
        public void RemoveNodeWithEdgesInGraphFromGraph()
        {
            Graph actual = new Graph(1);
            Graph expected = new Graph(1);

            Node a = new Node("a");
            Node b = new Node("b");

            Edge ab = new Edge(2);

            actual.AddNode(a);
            actual.AddNode(b);

            actual.AddUndirectedEdge(new Tuple<Node, int>(a, 0), new Tuple<Node, int>(b, 0), ab);

            actual.RemoveNode(b);

            expected.AddNode(a);

            Assert.IsTrue(actual.Equals(expected));
        }
示例#9
0
        public void RemoveNodeInGraphFromGraph()
        {
            Graph actual = new Graph(1);
            Graph expected = new Graph(1);

            Node a = new Node("a");
            Node b = new Node("b");

            actual.AddNode(a);
            actual.AddNode(b);
            actual.RemoveNode(b);

            expected.AddNode(a);

            Assert.IsTrue(actual.Equals(expected));
        }
示例#10
0
        public void TwoGraphWithTwoNodeOneRemoved()
        {
            Graph g1 = new Graph(1);
            Graph g2 = new Graph(2);

            Node a = new Node("a");
            Node b = new Node("b");
            Node c = new Node("b");

            g1.AddNode(a);
            g1.AddNode(b);
            g1.AddNode(c);
            g1.RemoveNode(c);

            g2.AddNode(a);
            g2.AddNode(b);
            g2.AddNode(c);
            g2.RemoveNode(c);

            Assert.IsFalse(g1.Equals(g2));
        }
示例#11
0
        public void TwoGraphWithThreeNodeWithSingleEdgeOneRemoved()
        {
            Graph g1 = new Graph(1);
            Graph g2 = new Graph(2);

            Node a = new Node("a");
            Node b = new Node("b");
            Node c = new Node("c");

            Edge ab = new Edge(1);
            Edge bc = new Edge(2);

            g1.AddNode(a);
            g1.AddNode(b);
            g1.AddNode(c);
            g1.AddUndirectedEdge(new Tuple<Node, int>(a, 0), new Tuple<Node, int>(b, 0), ab);
            g1.AddUndirectedEdge(new Tuple<Node, int>(b, 1), new Tuple<Node, int>(c, 0), bc);
            g1.RemoveUndirectedEdge(b, c);

            g2.AddNode(a);
            g2.AddNode(b);
            g2.AddNode(c);
            g1.AddUndirectedEdge(new Tuple<Node, int>(a, 0), new Tuple<Node, int>(b, 0), ab);
            g1.AddUndirectedEdge(new Tuple<Node, int>(b, 1), new Tuple<Node, int>(c, 0), bc);
            g2.RemoveUndirectedEdge(b, c);

            Assert.IsFalse(g1.Equals(g2));
        }