public bool MoveNext() { if (!_firstEdge) { while (_vertexEnumerator.MoveNext()) { while (_graphEnumerator.MoveTo(_vertexEnumerator.Current)) { if (!_graphEnumerator.MoveNext()) { break; } _firstEdge = true; return(true); } } return(false); } while (true) { if (_graphEnumerator.MoveNext()) { return(true); } if (!_vertexEnumerator.MoveNext()) { return(false); } while (_graphEnumerator.MoveTo(_vertexEnumerator.Current)) { if (_graphEnumerator.MoveNext()) { return(true); } if (!_vertexEnumerator.MoveNext()) { return(false); } } } }
/// <summary> /// Moves the enumerator to the first edge of the given vertex. /// </summary> /// <param name="vertex">The vertex.</param> /// <returns>True if the vertex exists.</returns> public bool MoveTo(VertexId vertex) { if (_enumerator == null) { throw new InvalidOperationException( $"Cannot reset an enumerator created from an {nameof(EdgeEnumerator)}."); } return(_enumerator.MoveTo(vertex)); }