added impl of WeightedGraph and default weight function