Table of Contents

Interface IMutableGraph<TVertex, TEdge>

Namespace
Graph1x
Assembly
Graph1x.dll

A graph that supports in-place mutation. Add/Remove operations follow the .NET collection idiom: they return false for duplicates or missing items instead of throwing.

public interface IMutableGraph<TVertex, TEdge> : IReadOnlyGraph<TVertex, TEdge> where TVertex : notnull where TEdge : IEdge<TVertex>

Type Parameters

TVertex

The vertex type.

TEdge

The edge type.

Inherited Members
Extension Methods

Methods

AddEdge(TEdge)

Adds edge to the graph, adding missing endpoint vertices automatically.

bool AddEdge(TEdge edge)

Parameters

edge TEdge

The edge to add.

Returns

bool

true if added; false if the graph forbids the edge (e.g. a parallel edge on a simple graph).

AddVertex(TVertex)

Adds vertex to the graph.

bool AddVertex(TVertex vertex)

Parameters

vertex TVertex

The vertex to add.

Returns

bool

true if added; false if it was already present.

Clear()

Removes every vertex and edge from the graph.

void Clear()

RemoveEdge(TEdge)

Removes edge from the graph. Endpoint vertices stay.

bool RemoveEdge(TEdge edge)

Parameters

edge TEdge

The edge to remove.

Returns

bool

true if removed; false if it was not present.

Remarks

The stored edge must equal edge under the edge type's default equality — VertexComparer locates the endpoints but never compares payloads. To remove an edge by its endpoints alone, use the endpoint-based overloads on the concrete graph types.

RemoveVertex(TVertex)

Removes vertex and every edge incident to it.

bool RemoveVertex(TVertex vertex)

Parameters

vertex TVertex

The vertex to remove.

Returns

bool

true if removed; false if it was not present.