示例#1
0
        public Topological(DirectedGraph graph)
        {
            DirectedCircle circleFinder = new DirectedCircle(graph);

            if (!circleFinder.HasCircle())
            {
                DepthFirstOrder dfs = new DepthFirstOrder(graph);
                Order = dfs.ReversePost();
            }
        }
示例#2
0
        public KosarajuConnectedComponent(DirectedGraph g)
        {
            marked = new bool[g.VertexSize];
            id     = new int[g.VertexSize];
            DepthFirstOrder order = new DepthFirstOrder(g.Reverse());

            foreach (var i in order.ReversePost())
            {
                if (!marked[i])
                {
                    Dfs(g, i);
                    Count++;
                }
            }
        }