Ejemplo n.º 1
0
 public TopologicalSort(IGraph <T, E> graph, IEnumerable <T> subset_vertices)
 {
     _graph = graph;
     _work  = subset_vertices;
     foreach (T v in _work)
     {
         EdgeClassifier.Classify(graph, v, ref classify);
     }
 }
Ejemplo n.º 2
0
        public TarjanNoBackEdges(IGraph <T, E> graph)
        {
            _graph = graph;
            _work  = _graph.Vertices;
            foreach (T v in _work)
            {
                if (graph.Predecessors(v).Any())
                {
                    continue;
                }

                EdgeClassifier.Classify(graph, v, ref classify);
            }
            foreach (T v in _work)
            {
                Index[v]   = -1;
                LowLink[v] = -1;
            }
        }