function sortFn(a, b) {
    var apct = getWeightedPercent(a);
    var bpct = getWeightedPercent(b);
    var diff = apct - bpct;

    if (diff === 0) {
      return ascending(a.id(), b.id()); // make sure sort doesn't have don't-care comparisons
    } else {
      return diff;
    }
  }
function sortFn(a, b) {
    var apct = getWeightedPercent(a);
    var bpct = getWeightedPercent(b);
    var diff = apct - bpct;

    if (diff === 0) {
      return ascending(a.id(), b.id()); // make sure sort doesn't have don't-care comparisons
    } else {
      return diff;
    }
  }
function sortFn ( a , b ) { var apct = getWeightedPercent ( a ) ; var bpct = getWeightedPercent ( b ) ; var diff = apct - bpct ; if ( diff === 0 ) { return ascending ( a . id ( ) , b . id ( ) ) ; // make sure sort doesn't have don't-care comparisons } else { return diff ; } }
rearrange the indices in each depth level based on connectivity
rearrange the indices in each depth level based on connectivity
sort function for the best guess