Table of Contents

Namespace Graph1x

Classes

AdjacencyMatrixGraphBase<TVertex, TEdge>

Shared machinery for adjacency-matrix graphs: dense storage with O(1) edge lookup, suited to dense graphs where V² cells are acceptable. The matrix grows by doubling; removing a vertex moves the last row/column into the vacated slot so the matrix stays compact. Simple-graph semantics (no parallel edges, self-loops allowed). The hierarchy is closed: use DirectedAdjacencyMatrixGraph<TVertex, TEdge> or UndirectedAdjacencyMatrixGraph<TVertex, TEdge>.

DirectedAcyclicGraph<TVertex, TEdge>

A directed graph that maintains acyclicity as an invariant: adding an edge that would create a cycle (including a self-loop) is rejected with false, mirroring how duplicates are rejected.

DirectedAdjacencyMatrixGraph<TVertex, TEdge>

A simple directed graph stored as a dense adjacency matrix: O(1) edge lookup and removal at O(V²) memory, the right trade-off for dense graphs.

DirectedGraph<TVertex, TEdge>

A simple directed graph (no parallel edges, self-loops allowed) backed by adjacency lists with separate out- and in-edge indexes for O(1) edge lookup in either direction.

DirectedMultigraph<TVertex, TEdge>

A directed multigraph: parallel edges between the same endpoints and self-loops are all allowed. Backed by per-vertex out/in edge lists.

GraphViewExtensions

Read-only views and immutable snapshots over any graph. A view is live (later mutations of the underlying graph show through); a frozen graph is a deep copy that never changes and is safe for concurrent readers.

UndirectedAdjacencyMatrixGraph<TVertex, TEdge>

A simple undirected graph stored as a dense symmetric adjacency matrix: O(1) edge lookup and removal at O(V²) memory, the right trade-off for dense graphs. Endpoint order never matters.

UndirectedGraph<TVertex, TEdge>

A simple undirected graph (no parallel edges, self-loops allowed) backed by adjacency lists. Edge endpoint order is irrelevant: an edge a-b is visible from both endpoints and equals the connection b-a.

UndirectedMultigraph<TVertex, TEdge>

An undirected multigraph: parallel edges between the same endpoints and self-loops are all allowed, and endpoint order never matters. Backed by per-vertex incidence lists.

Interfaces

IDirectedGraph<TVertex, TEdge>

A graph whose edges are directed, adding in/out refinements of the undirected structural queries.

IMutableGraph<TVertex, TEdge>

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.

IReadOnlyGraph<TVertex, TEdge>

Read-only view over a graph: vertex/edge enumeration and structural queries. All graph implementations, directed or undirected, sparse or dense, expose this contract.