/// given a vertex in the graph, find its upper and lower neighbor vertices protected Tuple <Vertex, Vertex> find_neighbor_vertices(VertexPair v_pair, Interval ival) { Interval.VertexPairIterator itr = ival.intersections2.lower_bound(v_pair); // returns first that is not less than argument (equal or greater) Debug.Assert(itr != ival.intersections2.end()); // we must find a lower_bound Interval.VertexPairIterator v_above = itr; // lower_bound returns one beyond the give key, i.e. what we want Interval.VertexPairIterator v_below = --itr; // this is the vertex below the give vertex Tuple <Vertex, Vertex> @out = new Tuple <Vertex, Vertex>(null, null); @out.Item1 = v_above.first; // vertex above v (xu) @out.Item2 = v_below.first; // vertex below v (xl) Debug.Assert(@out.Item1 != @out.Item2); return(new Tuple <Vertex, Vertex>(@out.Item1, @out.Item2)); }
// given a VertexPair and an Interval, in the Interval find the Vertex above and below the given vertex protected Tuple <Vertex, Vertex> find_neighbor_vertices(VertexPair v_pair, Interval ival, bool above_equality) { Interval.VertexPairIterator itr = ival.intersections2.lower_bound(v_pair); // returns first that is not less than argument (equal or greater) Debug.Assert(itr != ival.intersections2.end()); // we must find a lower_bound Interval.VertexPairIterator v_above = new Interval.VertexPairIterator(); if (above_equality) { //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created: //ORIGINAL LINE: v_above = itr; v_above.CopyFrom(itr); // lower_bound returns one beyond the give key, i.e. what we want } else { v_above = ++itr; --itr; } Interval.VertexPairIterator v_below = --itr; // this is the vertex below the given vertex Tuple <Vertex, Vertex> @out = new Tuple <Vertex, Vertex>(null, null); @out.Item1 = v_above.first; // vertex above v (xu) @out.Item2 = v_below.first; // vertex below v (xl) return(new Tuple <Vertex, Vertex>(@out.Item1, @out.Item2)); }