Skip to content

Commit

Permalink
coloring document (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-allergic authored Sep 26, 2024
1 parent 241559a commit 3cbdf41
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ makedocs(;
"Interfaces" => ["models.md", "topology.md", "rules.md"],
"Models" => [
"models/CircuitSAT.md",
"models/Coloring.md",
"models/Factoring.md",
"models/SpinGlass.md"
],
Expand Down
26 changes: 26 additions & 0 deletions docs/src/models/Coloring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Vertex Coloring

## Problem Definition
The Vertex Coloring (Coloring) problem is defined on a simple graph. Given k kinds of colors, we need to determine whether we can color all vertices on the graph such that no two adjacent vertices share the same color.
## Interfaces

To initialize a [`Coloring`](@ref) problem, we need to first define a simple graph and decide the number of colors.

```@repl Coloring
using ProblemReductions, Graphs
g = smallgraph(:petersen) # define a simple graph, petersen as example
coloring = Coloring{3}(g)
```
We create a petersen graph and take 3 colors here to initialize a Coloring Problem.

Functions [`variables`](@ref), [`flavors`](@ref), [`num_flavors`](@ref), [`parameters`](@ref) and [`set_parameters`](@ref) are implemented for `Coloring` model.
```@repl Coloring
variables(coloring)
flavors(coloring)
```

Also, [`evaluate`](@ref) and [`is_vertex_coloring`](@ref) is also implemented.
```@repl Coloring
is_vertex_coloring(coloring.graph,[1,2,3,1,3,2,1,2,3,1]) #random assignment
```

0 comments on commit 3cbdf41

Please sign in to comment.