Exemplo n.º 1
0
        public void testChildrenMultiGraph()
        {
            AdjacencyListGraph <string, string> g = graph(n1, n2, n3, n4);
            Edge <string, string> e5 = new Edge <string, string>(n2, n1, "lorem");

            g.AddEdge(e1); g.AddEdge(e2); g.AddEdge(e3); g.AddEdge(e4); g.AddEdge(e5);

            ISet <string> Children1 = g.Children(n1);

            Assert.IsTrue(Children1.Contains(n2));
            Assert.IsTrue(Children1.Contains(n4));
            Assert.AreEqual(2, Children1.Count);

            ISet <string> Children2 = g.Children(n2);

            Assert.IsTrue(Children2.Contains(n3));
            Assert.IsTrue(Children2.Contains(n1));
            Assert.AreEqual(2, Children2.Count);

            ISet <string> Children3 = g.Children(n3);

            Assert.IsTrue(Children3.Contains(n4));
            Assert.AreEqual(1, Children3.Count);

            ISet <string> Children4 = g.Children(n4);

            Assert.AreEqual(0, Children4.Count);
        }
Exemplo n.º 2
0
        public void testChildrenSimple()
        {
            AdjacencyListGraph <string, string> g = graph(n1, n2, n3, n4);

            g.AddEdge(e1); g.AddEdge(e4);

            ISet <string> Children1 = g.Children(n1);

            Assert.IsTrue(Children1.Contains(n2));
            Assert.IsTrue(Children1.Contains(n4));
            Assert.AreEqual(2, Children1.Count);
        }
Exemplo n.º 3
0
        public void testParentWithParentlessChild()
        {
            AdjacencyListGraph <string, string> g = graph(n1);

            Assert.IsTrue(g.Children(n1).Count == 0);
        }
Exemplo n.º 4
0
        public void testChildrenWithEmptyGraph()
        {
            AdjacencyListGraph <string, string> g = graph();

            Assert.IsNull(g.Children(n1));
        }
Exemplo n.º 5
0
        public void testChildrenNull()
        {
            AdjacencyListGraph <string, string> g = graph();

            g.Children(null);
        }