public static void CloneOutVertexTree(IVertexListGraph g, ISerializableVertexAndEdgeListGraph sub, IVertex v, int maxDepth)
 {
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     if (sub == null)
     {
         throw new ArgumentNullException("sub");
     }
     if (v == null)
     {
         throw new ArgumentNullException("v");
     }
     DepthFirstSearchAlgorithm algorithm = new DepthFirstSearchAlgorithm(g);
     PopulatorVisitor visitor = new PopulatorVisitor(sub);
     algorithm.StartVertex += new VertexEventHandler(visitor, (IntPtr) this.StartVertex);
     algorithm.TreeEdge += new EdgeEventHandler(visitor, (IntPtr) this.TreeEdge);
     algorithm.MaxDepth = maxDepth;
     algorithm.Initialize();
     algorithm.Visit(v, 0);
 }
Пример #2
0
        public static void CloneOutVertexTree(
            IVertexListGraph g,
            ISerializableVertexAndEdgeListGraph sub,
            IVertex v,
            int maxDepth
            )
        {
            if (g==null)
                throw new ArgumentNullException("g");
            if (sub==null)
                throw new ArgumentNullException("sub");
            if (v==null)
                throw new ArgumentNullException("v");

            DepthFirstSearchAlgorithm dfs = new DepthFirstSearchAlgorithm(g);

            PopulatorVisitor pop = new PopulatorVisitor(sub);
            dfs.StartVertex += new VertexEventHandler(pop.StartVertex);
            dfs.TreeEdge += new EdgeEventHandler(pop.TreeEdge);

            dfs.MaxDepth = maxDepth;
            dfs.Initialize();
            dfs.Visit(v,0);
        }