Beispiel #1
0
 internal DepthFirstEnumerator([NotNull] WeightedGraphList <T, TWeight> graph, T root)
 {
     _graph   = graph;
     _version = _graph._version;
     _root    = root;
     _current = default(T);
     _started = _hasValue = false;
     _done    = _graph.Count == 0 || _root == null;
     _visited = _done ? null : new HashSet <T>(graph.Comparer);
     _stack   = _done ? null : new Stack <T>();
 }
Beispiel #2
0
            internal EdgeEnumerator([NotNull] WeightedGraphList <T, TWeight> graph)
            {
                _graph   = graph;
                _version = graph._version;
                _current = default(EdgeEntry <T, GraphEdge <T, TWeight> >);
                _started = false;
                _done    = _graph.Count == 0;

                if (_done)
                {
                    _queue = null;
                    _edges = null;
                }
                else
                {
                    _queue = new Queue <T>();
                    _edges = new Queue <EdgeEntry <T, GraphEdge <T, TWeight> > >();
                }
            }