示例#1
0
        public void ExecuteDFS(Graph graph, string current)
        {
            timestamps.Add(current);
            int  idx = graph.GetNodesIdx(current);
            Node x   = graph.GetNodes(idx);

            if (x.GetPostreqCount() != 0)
            {
                for (int i = 0; i < x.GetPostreqCount(); i++)
                {
                    if (!HasVisited(x.GetPostreq(i)))
                    {
                        ExecuteDFS(graph, x.GetPostreq(i));
                    }
                }
                timestamps.Add(current);
            }
            else
            {
                timestamps.Add(current);
            }
        }
示例#2
0
        public Node(Node _Node)
        {
            Value = _Node.Value;
            List <string> Prereq  = new List <string>();
            List <string> Postreq = new List <string>();

            for (int i = 0; i < _Node.GetPrereqCount(); ++i)
            {
                AddPrereq(_Node.GetPrereq(i));
            }
            for (int i = 0; i < _Node.GetPostreqCount(); ++i)
            {
                AddPostreq(_Node.GetPostreq(i));
            }
        }