Example #1
0
        static bool DeepIterator_Reccurent(IVertex iterationRoot, GraphIteratorIterate iterate, List <IVertex> visited, List <IVertex> returnList, bool isSingleResult)
        {
            bool toReturn = false;

            foreach (IEdge e in iterationRoot.OutEdges)
            {
                if (!visited.Contains(e.To))
                {
                    visited.Add(e.To);
                    if (iterate(e))
                    {
                        returnList.Add(e.To);
                        if (isSingleResult)
                        {
                            return(true);
                        }
                    }

                    if (DeepIterator_Reccurent(e.To, iterate, visited, returnList, isSingleResult))
                    {
                        toReturn = true;

                        break;
                    }
                }
            }

            return(toReturn);
        }
Example #2
0
        static public IEnumerable <IVertex> DeepIterator(IVertex iterationRoot, GraphIteratorIterate iterate, bool isSingleResult)
        {
            List <IVertex> visited = new List <IVertex>();

            List <IVertex> returnList = new List <IVertex>();

            DeepIterator_Reccurent(iterationRoot, iterate, visited, returnList, isSingleResult);

            return(returnList);
        }