Skip to content

Mutating Graphs

Alexandre Rabérin edited this page May 12, 2020 · 1 revision

Mutating Graphs

Most data structures are mutable and support batched addition/removal of vertices/edges.

Removing vertices with a predicate

var graph = new AjacencyGraph<string, Edge<string>>();
...
// Remove any vertex starting with foo
int removed = graph.RemoveVertexIf(v => v.StartsWith("foo"));
Console.WriteLine($"{removed} vertices removed");
Clone this wiki locally