Get the neighbor that share this edge

@param constrainedEdge
@return index of the shared edge or -1 if edge isn't shared
496528
public int edgeIndex( TriangulationPoint p1, TriangulationPoint p2 )
    {
        if( points[0] == p1 )
        {
            if( points[1] == p2 )
            {
                return 2;
            }
            else if( points[2] == p2 )
            {
                return 1;                
            }
        }
        else if( points[1] == p1 )
        {
            if( points[2] == p2 )
            {
                return 0;
            }
            else if( points[0] == p2 )
            {
                return 2;                
            }
        }
        else if( points[2] == p1 )
        {
            if( points[0] == p2 )
            {
                return 1;
            }
            else if( points[1] == p2 )
            {
                return 0;                
            }            
        }
        return -1;
    }
811246
public int getNumberOfConnections() {
		int ret = 0;
		for (int i = 0; i < square.size(); i++) {
			if( edges[i] != null )
				ret++;
		}
		return ret;
	}
125772
public final Bounds intersect(Bounds b) {
		final long _min = Math.max(this.min, b.min);
		final long _max = Math.min(this.max, b.max);
		if(_min <= _max) return new Bounds(_min, _max);
		return null;
	}
1225272
private int getLevel(int i) {
		int n=0;
		Integer j=i;
		while((j=edgesInv.get(j))!=null){
			n++;
		}
		return n;
	}
581964
static int lowerEdgeIndex( SquareNode node ) {
		for (int i = 0; i < node.square.size(); i++) {
			if( isOpenEdge(node,i) ) {
				int next = addOffset(i,1,node.square.size());
				if( isOpenEdge(node,next)) {
					return i;
				}
				if( i == 0 ) {
					int previous = node.square.size()-1;
					if( isOpenEdge(node,previous)) {
						return previous;
					}
				}
				return i;
			}
		}

		throw new RuntimeException("BUG!");
	}
1108897
public ManagementEdge getBackwardEdge(final int index) {

		if (index < this.backwardEdges.size()) {
			return this.backwardEdges.get(index);
		}

		return null;
	}
44823
def get_neighbors( self, peer_hostport, con=None, path=None, peer_table=None ):
        
        if path is None:
            path = self.atlasdb_path

        if self.neighbors_timeout is None:
            self.neighbors_timeout = atlas_neighbors_timeout()
 
        peer_hostport = self.canonical_peer( peer_hostport )

        neighbors = None
        if peer_hostport == self.my_hostport:
            neighbors = atlas_get_live_neighbors( None, peer_table=peer_table ) 
        else:
            neighbors = atlas_peer_get_neighbors( self.my_hostport, peer_hostport, timeout=self.neighbors_timeout, peer_table=peer_table, path=path, con=con )

        if neighbors is not None:
            log.debug("%s: neighbors of %s are (%s): %s" % (self.my_hostport, peer_hostport, len(neighbors), ",".join(neighbors)))
        else:
            log.error("%s: failed to ask %s for neighbors" % (self.my_hostport, peer_hostport))

        return neighbors
346228
def find(self, i):
        '''
        
        '''
        current = i
        edge_list = []
        while len(self.get_neighbors(current)) != 0:
            successor = self.get_neighbors(current)[0]
            edge_list.append((current, successor))
            current = successor
        if self.optimize:
            for e in edge_list:
                if e[1] != current:
                    self.del_edge((e[0], e[1]))
                    self.add_edge(e[0], current)
        return current
396496
def neighbors_of( p )
      Set.new.tap do |neighbors|
        i = index_mapping[p]
        (0..index_mapping.size-1).each do |j|
          neighbors.add(points[j]) if adjacency_matrix.lookup(i,j) <= eps
        end
      end
    end
947546
public static int getCAPathConstraint(TBSCertificateStructure crt)
            throws IOException {

        X509Extensions extensions = crt.getExtensions();
        if (extensions == null) {
            return -1;
        }
        X509Extension proxyExtension =
                extensions.getExtension(X509Extension.basicConstraints);
        if (proxyExtension != null) {
            BasicConstraints basicExt =
                    getBasicConstraints(proxyExtension);
            if (basicExt.isCA()) {
                BigInteger pathLen = basicExt.getPathLenConstraint();
                return (pathLen == null) ? Integer.MAX_VALUE : pathLen.intValue();
            } else {
                return -1;
            }
        }
        return -1;
    }
1172687
def find_neighbors(self, grid, node, diagonal_movement=None):
        '''
        
        '''
        if not diagonal_movement:
            diagonal_movement = self.diagonal_movement
        return grid.neighbors(node, diagonal_movement=diagonal_movement)
1373480
public Constraint getUniqueOrPKConstraintForIndex(Index index) {

        for (int i = 0, size = constraintList.length; i < size; i++) {
            Constraint c = constraintList[i];

            if (c.getMainIndex() == index
                    && (c.getConstraintType() == Constraint.UNIQUE
                        || c.getConstraintType() == Constraint.PRIMARY_KEY)) {
                return c;
            }
        }

        return null;
    }
1247440
void findVertexNeighbors(Vertex target  , List<ChessboardCorner> corners ) {
//		if( target.index == 18 ) {
//			System.out.println("Vertex Neighbors "+target.index);
//		}

		ChessboardCorner targetCorner = corners.get(target.index);
		// distance is Euclidean squared
		double maxDist = Double.MAX_VALUE==maxNeighborDistance?maxNeighborDistance:maxNeighborDistance*maxNeighborDistance;
		nnSearch.findNearest(corners.get(target.index),maxDist,maxNeighbors,nnResults);

		// storage distances here to find median distance of closest neighbors
		distanceTmp.reset();

		for (int i = 0; i < nnResults.size; i++) {
			NnData<ChessboardCorner> r = nnResults.get(i);
			if( r.index == target.index) continue;

			distanceTmp.add( r.distance );

			double oriDiff = UtilAngle.distHalf( targetCorner.orientation , r.point.orientation );

			Edge edge = edges.grow();
			boolean parallel;
			if( oriDiff <= orientationTol) { // see if it's parallel
				parallel = true;
			} else if( Math.abs(oriDiff-Math.PI/2.0) <= orientationTol) { // see if it's perpendicular
				parallel = false;
			} else {
				edges.removeTail();
				continue;
			}

			// Use the relative angles of orientation and direction to prune more obviously bad matches
			double dx = r.point.x - targetCorner.x;
			double dy = r.point.y - targetCorner.y;

			edge.distance = Math.sqrt(r.distance);
			edge.dst = vertexes.get(r.index);
			edge.direction = Math.atan2(dy,dx);

			double direction180 = UtilAngle.boundHalf(edge.direction);
			double directionDiff = UtilAngle.distHalf(direction180,r.point.orientation);
			boolean remove;
			EdgeSet edgeSet;
			if( parallel ) {
				// test to see if direction and orientation are aligned or off by 90 degrees
				remove = directionDiff > 2* directionTol && Math.abs(directionDiff-Math.PI/2.0) > 2* directionTol;
				edgeSet = target.parallel;
			} else {
				// should be at 45 degree angle
				remove = Math.abs(directionDiff-Math.PI/4.0) > 2* directionTol;
				edgeSet = target.perpendicular;
			}

			if( remove ) {
				edges.removeTail();
				continue;
			}

			edgeSet.add(edge);
		}

		// Compute the distance of the closest neighbors. This is used later on to identify ambiguous corners.
		// If it's a graph corner there should be at least 3 right next to the node.
		if( distanceTmp.size == 0 ) {
			target.neighborDistance = 0;
		} else {
			sorter.sort(distanceTmp.data, distanceTmp.size);
			int idx = Math.min(3,distanceTmp.size-1);
			target.neighborDistance = Math.sqrt(distanceTmp.data[idx]); // NN distance is Euclidean squared
		}
	}
590980
private static <T, ET> boolean hasNullValueEdges(DataSet<Edge<T, ET>> edges) {
		TypeInformation<?> genericTypeInfo = edges.getType();
		@SuppressWarnings("unchecked")
		TupleTypeInfo<Tuple3<T, T, ET>> tupleTypeInfo = (TupleTypeInfo<Tuple3<T, T, ET>>) genericTypeInfo;

		return tupleTypeInfo.getTypeAt(2).equals(ValueTypeInfo.NULL_VALUE_TYPE_INFO);
	}
223319
public ManagementGroupEdge getBackwardEdge(final int index) {

		if (index < this.backwardEdges.size()) {
			return this.backwardEdges.get(index);
		}

		return null;
	}
577293
def _get_constraints(self):
        """"""
        num_edges = len(self.edges)
        for k in range(num_edges):
            for i in range(num_edges):
                # add to constraints if i shared an edge with k
                if k != i and self.edges[k].is_adjacent(self.edges[i]):
                    self.edges[k].neighbors.append(i)
173922
public Edge lookupEdgeById(int id) {
        Iterator<Edge> i = edgeIterator();
        while (i.hasNext()) {
            Edge edge = i.next();
            if (edge.getId() == id) {
                return edge;
            }
        }
        return null;
    }