Table of Contents

Class GraphCliqueExtensions

Namespace
Graph1x.Algorithms
Assembly
Graph1x.dll

Maximal clique enumeration via Bron–Kerbosch with Tomita pivoting. Edge direction is ignored, self-loops never count, and on multigraphs neighbors are counted once regardless of parallel edges.

public static class GraphCliqueExtensions
Inheritance
GraphCliqueExtensions
Inherited Members

Methods

EnumerateMaximalCliques<TVertex, TEdge>(IReadOnlyGraph<TVertex, TEdge>)

Lazily enumerates every maximal clique: each set of mutually adjacent vertices that no further vertex can extend. Enumeration is iterative (no recursion) and streaming; because the number of maximal cliques can grow exponentially with the vertex count, the caller controls the cost by how far the sequence is enumerated — there is deliberately no CancellationToken overload, as pull-based enumeration is already cooperative.

public static IEnumerable<IReadOnlyList<TVertex>> EnumerateMaximalCliques<TVertex, TEdge>(this IReadOnlyGraph<TVertex, TEdge> graph) where TVertex : notnull where TEdge : IEdge<TVertex>

Parameters

graph IReadOnlyGraph<TVertex, TEdge>

The graph to search.

Returns

IEnumerable<IReadOnlyList<TVertex>>

The maximal cliques, each as a list of vertices; deterministic order for a given graph. The empty graph yields no cliques; an isolated vertex forms a single-vertex clique.

Type Parameters

TVertex

The vertex type.

TEdge

The edge type.

Exceptions

ArgumentNullException

graph is null.