code: private <E extends Edge> double getConnectionSimilarity(
              Graph<E> graph, Edge e1, Edge e2) {
          int e1to = e1.to();
          int e1from = e1.from();
          int e2to = e2.to();
          int e2from = e2.from();
          if (e1to == e2to)
              return getConnectionSimilarity(graph, e1to, e1from, e2from);
          else if (e1to == e2from)
              return getConnectionSimilarity(graph, e1to, e1from, e2to);
          else if (e1from == e2to)
              return getConnectionSimilarity(graph, e1from, e1to, e2from);
          else if (e1from == e2from)
              return getConnectionSimilarity(graph, e1from, e1to, e2to);
          else
              return 0;
      }
docs: Computes the connection similarity for the two edges, first calculating
  the impost and keystones nodes.  If the edges are not connected, returns
  0.
  
  @see #getConnectionSimilarity(Graph,int,int,int)