Graphic implementation of kruskal's algorithm with javascript