code: public static int createEdgeKey(int nodeA, int nodeB, int edgeId, boolean reverse) {
          edgeId = edgeId << 1;
          if (reverse)
              return (nodeA > nodeB) ? edgeId : edgeId + 1;
          return (nodeA > nodeB) ? edgeId + 1 : edgeId;
      }
docs: Creates unique positive number for specified edgeId taking into account the direction defined
  by nodeA, nodeB and reverse.