Html5 canvas - graph drawing algorithm with ability to add and remove nodes and connect them with each other