Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExactDepthFinder()
        public virtual void TestExactDepthFinder()
        {
            // Layout (a to k):
            //
            //     (a)--(c)--(g)--(k)
            //    /                /
            //  (b)-----(d)------(j)
            //   |        \      /
            //  (e)--(f)--(h)--(i)
            //
            Graph.makeEdgeChain("a,c,g,k");
            Graph.makeEdgeChain("a,b,d,j,k");
            Graph.makeEdgeChain("b,e,f,h,i,j");
            Graph.makeEdgeChain("d,h");
            PathExpander <object> expander = PathExpanders.forTypeAndDirection(MyRelTypes.R1, Direction.OUTGOING);
            Node a = Graph.getNode("a");
            Node k = Graph.getNode("k");

            AssertPaths(GraphAlgoFactory.pathsWithLength(expander, 3).findAllPaths(a, k), "a,c,g,k");
            AssertPaths(GraphAlgoFactory.pathsWithLength(expander, 4).findAllPaths(a, k), "a,b,d,j,k");
            AssertPaths(GraphAlgoFactory.pathsWithLength(expander, 5).findAllPaths(a, k));
            AssertPaths(GraphAlgoFactory.pathsWithLength(expander, 6).findAllPaths(a, k), "a,b,d,h,i,j,k");
            AssertPaths(GraphAlgoFactory.pathsWithLength(expander, 7).findAllPaths(a, k), "a,b,e,f,h,i,j,k");
            AssertPaths(GraphAlgoFactory.pathsWithLength(expander, 8).findAllPaths(a, k));
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExactDepthPathsReturnsNoLoops()
        public virtual void TestExactDepthPathsReturnsNoLoops()
        {
            // Layout:
            //
            // (a)-->(b)==>(c)-->(e)
            //        ^    /
            //         \  v
            //         (d)
            //
            Graph.makeEdgeChain("a,b,c,d,b,c,e");
            Node a = Graph.getNode("a");
            Node e = Graph.getNode("e");

            AssertPaths(GraphAlgoFactory.pathsWithLength(PathExpanders.forType(MyRelTypes.R1), 3).findAllPaths(a, e), "a,b,c,e", "a,b,c,e");
            AssertPaths(GraphAlgoFactory.pathsWithLength(PathExpanders.forType(MyRelTypes.R1), 4).findAllPaths(a, e), "a,b,d,c,e");
            AssertPaths(GraphAlgoFactory.pathsWithLength(PathExpanders.forType(MyRelTypes.R1), 6).findAllPaths(a, e));
        }