/// <summary> /// Determine whether node is contained in currrent or previous segments. /// </summary> /// <param name="node">Tested node.</param> /// <returns><c>true</c> whether node is contained, <c>false</c> otherwise.</returns> internal bool Contains(NodeReference node) { if (Node.Equals(node)) { return(true); } if (PreviousSegment == null) { return(false); } return(PreviousSegment.Contains(node)); }
private void addChildren(NodeReference node, PathSegment previousSegment, ComposedGraph graph) { foreach (var edgeTuple in graph.GetNeighbours(node, _maxSearchWidth)) { var edge = edgeTuple.Item1; var child = edgeTuple.Item2; if (previousSegment != null && (previousSegment.Contains(child) || (_distinctEdges && previousSegment.Contains(edge.Name)))) { //the node has already been visited previously in the path continue; } if (previousSegment.SegmentIndex < _maxSearchDepth) { _segmentsToVisit.Enqueue(new PathSegment(previousSegment, edge, child)); } } }