Some changes to WeightedDirectedGraph for better concurrency support