created graph of weighted nodes and edges