/**
   * @param queryEdge
   * @param graphEdge
   * @param r
   * @return
   */
  protected boolean edgeMatch(Edge queryEdge, Edge graphEdge, IsomorphicQuery r) {

    if (queryEdge.getLabel() != 0L && queryEdge.getLabel() != graphEdge.getLabel().longValue()) {
      return false;
    }

    Long querySource = null;
    Long queryDestination = null;
    Long graphSource = null;
    Long graphDestination = null;

    if (r != null) {
      if (r.isUsing(graphEdge)) {
        return false;
      }

      querySource = queryEdge.getSource();
      graphSource = graphEdge.getSource();

      boolean mappedSource = r.hasMapped(querySource);
      boolean usingSource = r.isUsing(graphSource);

      if (usingSource && !mappedSource) {
        return false;
      }

      queryDestination = queryEdge.getDestination();
      graphDestination = graphEdge.getDestination();

      boolean mappedDestination = r.hasMapped(queryDestination);
      boolean usingDestination = r.isUsing(graphDestination);
      if (usingDestination && !mappedDestination) {
        return false;
      }

      if (mappedSource && !graphSource.equals(r.isomorphicMapOf(querySource).getNodeID())) {
        return false;
      }

      if (mappedDestination
          && !graphDestination.equals(r.isomorphicMapOf(queryDestination).getNodeID())) {
        return false;
      }

      if (usingSource && !r.mappedAs(graphSource).equals(querySource)) {
        return false;
      }

      if (usingDestination && !r.mappedAs(graphDestination).equals(queryDestination)) {
        return false;
      }
    }
    return true;
  }