-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
241559a
commit 3cbdf41
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |