clean-pslg.js
function dedupEdges (edges, labels, useColor) {
  if (edges.length === 0) {
    return
  }
  if (labels) {
    for (var i = 0; i < edges.length; ++i) {
      var e = edges[i]
      var a = labels[e[0]]
      var b = labels[e[1]]
      e[0] = Math.min(a, b)
      e[1] = Math.max(a, b)
    }
  } else {
    for (var i = 0; i < edges.length; ++i) {
      var e = edges[i]
      var a = e[0]
      var b = e[1]
      e[0] = Math.min(a, b)
      e[1] = Math.max(a, b)
    }
  }
  if (useColor) {
    edges.sort(compareLex3)
  } else {
    edges.sort(compareLex2)
  }
  var ptr = 1
  for (var i = 1; i < edges.length; ++i) {
    var prev = edges[i - 1]
    var next = edges[i]
    if (next[0] === prev[0] && next[1] === prev[1] &&
      (!useColor || next[2] === prev[2])) {
      continue
    }
    edges[ptr++] = next
  }
  edges.length = ptr
}
function dedupEdges (edges, labels, useColor) {
  if (edges.length === 0) {
    return
  }
  if (labels) {
    for (var i = 0; i < edges.length; ++i) {
      var e = edges[i]
      var a = labels[e[0]]
      var b = labels[e[1]]
      e[0] = Math.min(a, b)
      e[1] = Math.max(a, b)
    }
  } else {
    for (var i = 0; i < edges.length; ++i) {
      var e = edges[i]
      var a = e[0]
      var b = e[1]
      e[0] = Math.min(a, b)
      e[1] = Math.max(a, b)
    }
  }
  if (useColor) {
    edges.sort(compareLex3)
  } else {
    edges.sort(compareLex2)
  }
  var ptr = 1
  for (var i = 1; i < edges.length; ++i) {
    var prev = edges[i - 1]
    var next = edges[i]
    if (next[0] === prev[0] && next[1] === prev[1] &&
      (!useColor || next[2] === prev[2])) {
      continue
    }
    edges[ptr++] = next
  }
  edges.length = ptr
}
function dedupEdges ( edges , labels , useColor ) { if ( edges . length === 0 ) { return } if ( labels ) { for ( var i = 0 ; i < edges . length ; ++ i ) { var e = edges [ i ] var a = labels [ e [ 0 ] ] var b = labels [ e [ 1 ] ] e [ 0 ] = Math . min ( a , b ) e [ 1 ] = Math . max ( a , b ) } } else { for ( var i = 0 ; i < edges . length ; ++ i ) { var e = edges [ i ] var a = e [ 0 ] var b = e [ 1 ] e [ 0 ] = Math . min ( a , b ) e [ 1 ] = Math . max ( a , b ) } } if ( useColor ) { edges . sort ( compareLex3 ) } else { edges . sort ( compareLex2 ) } var ptr = 1 for ( var i = 1 ; i < edges . length ; ++ i ) { var prev = edges [ i - 1 ] var next = edges [ i ] if ( next [ 0 ] === prev [ 0 ] && next [ 1 ] === prev [ 1 ] && ( ! useColor || next [ 2 ] === prev [ 2 ] ) ) { continue } edges [ ptr ++ ] = next } edges . length = ptr }
Remove duplicate edge labels
Remove duplicate edge labels