addEdges method
Adds weighted edges pointing from vertex
to weightedEdges.keys
.
Implementation
void addEdges(T vertex, Map<T, W> weightedEdges) {
if (_edges[vertex] == null) {
// If vertex is new add it to the graph.
_edges[vertex] = Map.of(weightedEdges);
} else {
_edges[vertex]!.addAll(weightedEdges);
}
/// Add any new connected vertices to the graph.
for (final connectedVertex in weightedEdges.keys) {
_edges[connectedVertex] ??= <T, W>{};
}
updateCache();
}