ch/graph-coloring/app.js
//d is data, i is index according to selection
d is data, i is index according to selection
d is data i is index according to selection
function removeNode(d, i){
  var e = d3.event;
  if(e.ctrlKey) return;
  nodes.splice(nodes.indexOf(d),1);
  var linksToRemove = links.filter(function(l){
    return l.source===d || l.target===d;
  });
  linksToRemove.map(function(l) {
    links.splice(links.indexOf(l), 1);
  });
  e.preventDefault();
  restart();
  showGraphLatex();
}
function removeNode ( d , i ) { var e = d3 . event ; if ( e . ctrlKey ) return ; nodes . splice ( nodes . indexOf ( d ) , 1 ) ; var linksToRemove = links . filter ( function ( l ) { return l . source === d || l . target === d ; } ) ; linksToRemove . map ( function ( l ) { links . splice ( links . indexOf ( l ) , 1 ) ; } ) ; e . preventDefault ( ) ; restart ( ) ; showGraphLatex ( ) ; }
d is data, i is index according to selection
d is data i is index according to selection
//to make ctrl-drag works for mac/osx users