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
TVertexThe 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
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
vertexTVertexThe vertex to look up.
Returns
- int
The zero-based color.
Exceptions
- ArgumentException
vertexwas not part of the colored graph.