removeEdges method

void removeEdges(
  1. T vertex,
  2. Set<T> connectedVertices
)

Removes edges pointing from vertex to connectedVertices.

Does not remove any vertices from the graph.

Implementation

void removeEdges(T vertex, Set<T> connectedVertices) {
  // Return early if vertex does not belong to the graph.
  if (!_edges.containsKey(vertex)) return;
  _edges[vertex]?.removeWhere(
    (connectedVertex, edgeWeight) => connectedVertices.contains(
      connectedVertex,
    ),
  );
  updateCache();
}