public void TestWalkDirectedCyclicGraph( )
        {
            IGraphNode n0 = new GraphNode( "n0", 0 );
            IGraphNode n1 = new GraphNode( "n1", 1 );
            IGraphNode n2 = new GraphNode( "n2", 2 );
            n0.AddOutputNode( n1 );
            n1.AddOutputNode( n2 );
            n2.AddOutputNode( n0 );

            GraphNodeWalker.Walk( new IGraphNode[] { n0 }, new MockVisitor( n0, n1, n2 ) );
        }
        public void TestWalkDirectedAcyclicGraph( )
        {
            IGraphNode n0 = new GraphNode( "n0", 0 );
            IGraphNode n1 = new GraphNode( "n1", 1 );
            IGraphNode n2 = new GraphNode( "n2", 2 );
            IGraphNode n3 = new GraphNode( "n3", 3 );
            IGraphNode n4 = new GraphNode( "n4", 4 );
            IGraphNode n5 = new GraphNode( "n5", 5 );
            IGraphNode n6 = new GraphNode( "n6", 6 );
            n0.AddOutputNode( n2 );
            n1.AddOutputNode( n2 );	//	n2 has two inputs (n0,n1). n1 is not in the start node list

            n3.AddInputNode( n2 );	//	Should be the same as n2.AddOutputNode( n3 )
            n4.AddInputNode( n3 );
            n5.AddInputNode( n4 );
            n5.AddInputNode( n1 );
            n6.AddInputNode( n5 );
            GraphNodeWalker.Walk( new IGraphNode[] { n0 }, new MockVisitor( n0, n1, n2, n3, n4, n5, n6 ) );
        }
 public void TestWalkTreeGraph( )
 {
     IGraphNode root = new GraphNode( "root", 0 );
     IGraphNode n1 = new GraphNode( "n1", 1 );
     IGraphNode n2 = new GraphNode( "n2", 2 );
     IGraphNode n3 = new GraphNode( "n3", 3 );
     IGraphNode n4 = new GraphNode( "n4", 4 );
     IGraphNode n5 = new GraphNode( "n5", 5 );
     IGraphNode n6 = new GraphNode( "n6", 6 );
     root.AddOutputNode( n1 );
     root.AddOutputNode( n2 );
     n1.AddOutputNode( n3 );
     n1.AddOutputNode( n4 );
     n2.AddOutputNode( n5 );
     n2.AddOutputNode( n6 );
     GraphNodeWalker.Walk( new IGraphNode[] { root }, new MockVisitor( root, n1, n2, n3, n4, n5, n6 ) );
 }