computeIndex property

double get computeIndex

Implementation

double get computeIndex {
  var edgeList = cpn?.graph.edgesFromTwoVertex(start, end) ?? [];
  var idx = edgeList.indexOf(this);
  if (edgeList.length.isOdd) {
    if (idx.isEven) {
      return idx / 2;
    } else {
      return -(idx + 1) / 2;
    }
  } else {
    if (idx.isEven) {
      return idx / 2 + 0.5;
    } else {
      return -(idx - 1) / 2 - 0.5;
    }
  }
}