Table of Contents

Class GraphColoring<TVertex>

Namespace
Graph1x.Algorithms
Assembly
Graph1x.dll

A proper vertex coloring: adjacent vertices always receive different colors. Colors are contiguous integers starting at zero, and ColorCount is an upper bound on the chromatic number.

public sealed class GraphColoring<TVertex> where TVertex : notnull

Type Parameters

TVertex

The vertex type.

Inheritance
GraphColoring<TVertex>
Inherited Members

Properties

ColorCount

Gets the number of distinct colors used (an upper bound on the chromatic number).

public int ColorCount { get; }

Property Value

int

Colors

Gets the color assigned to every vertex.

public IReadOnlyDictionary<TVertex, int> Colors { get; }

Property Value

IReadOnlyDictionary<TVertex, int>

Methods

ColorOf(TVertex)

Gets the color assigned to vertex.

public int ColorOf(TVertex vertex)

Parameters

vertex TVertex

The vertex to look up.

Returns

int

The zero-based color.

Exceptions

ArgumentException

vertex was not part of the colored graph.