Add weight to Node and Edge
Use  instead of js's Math.floor