Javascript (HTML5) Multigraph Implementation