Пример #1
0
        public TopologicalSort(AdjacencyList <T, TNode> list)
        {
            _list        = list;
            _results     = new List <TNode>();
            _sourceNodes = _list.SourceNodes;

            Sort();
        }
Пример #2
0
        public TopologicalSort(AdjacencyList <T, TNode> list, T source)
        {
            _list    = list;
            _results = new List <TNode>();

            TNode sourceNode = list.GetNode(source);

            _sourceNodes = Enumerable.Repeat(sourceNode, 1);

            Sort();
        }
Пример #3
0
        public Tarjan(AdjacencyList <T, TNode> list)
        {
            _list   = list;
            _index  = 0;
            _result = new List <IList <TNode> >();
            _stack  = new Stack <TNode>();

            foreach (TNode node in _list.SourceNodes)
            {
                if (node.Index != -1)
                {
                    continue;
                }

                Compute(node);
            }
        }
Пример #4
0
 public DependencyGraph(int capacity)
 {
     _adjacencyList = new AdjacencyList <T, DependencyGraphNode <T> >(DefaultNodeFactory, capacity);
 }