Ejemplo n.º 1
0
        public Topological(EdgeWeightedDigraph G)
        {
            var cycleFinder = new DirectedCycle(G);

            if (!cycleFinder.HasCycle())
            {
                var dfs = new DepthFirstOrder(G);
                Order = dfs.ReversePost;
            }
        }
Ejemplo n.º 2
0
        public KosarajuSCC(Digraph G)
        {
            Marked = new bool[G.V];
            id     = new int[G.V];
            var order = new DepthFirstOrder(G.Reverse());

            foreach (var w in order.ReversePost)
            {
                if (!Marked[w])
                {
                    DFS(G, w);
                    count++;
                }
            }
        }