graph_coloring: Graph Coloring over Adjacency List

Description Usage Arguments Details Functions References See Also Examples

Description

These functions perform graph coloring using various algorithms over an adjacency list.

In graph theory, graph coloring is a special case of graph labeling; it is an assignment of labels traditionally called "colors" to elements of a graph subject to certain constraints. In its simplest form, it is a way of coloring the vertices of a graph such that no two adjacent vertices share the same color; this is called a vertex coloring.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
graph_coloring_dsatur(adj_list)

graph_coloring_msc(adj_list)

graph_coloring_lmxrlf(adj_list)

graph_coloring_hybrid_dsatur_tabucol(adj_list)

graph_coloring_hybrid_lmxrlf_tabucol(adj_list)

graph_coloring_tabucol(adj_list, k, tabu_size = 25L, rep = 100L, nbmax = 1000L)

Arguments

adj_list

an adjacency list in the format of list of integer vector. The outer list should enumerate nodes comprehensively and each integer vector enumerates corresponding neighboring nodes

k

number of colors to use for graph coloring

tabu_size

size of tabu list

rep

number of inner iterations

nbmax

maximum number of non-improving outer iterations

Details

graph_coloring_hybrid_dsatur_tabucol() and graph_coloring_hybrid_lmxrlf_tabucol() use a hybrid approach to run DSATUR and lmXRLF first to determine an upper bound for the graph chromatic number. It then searches better solutions by running lowered chromatic number through TabuCol to check if the graph can be colored with less colors.

Functions

References

https://en.wikipedia.org/wiki/Graph_coloring

https://github.com/brrcrites/GraphColoring

\insertRef

Brelaz:1979:NMC:359094.359101graphcoloring

\insertRef

Palsberg:2007:RAV:1273694.1273695graphcoloring

\insertRef

Kirovski:1998:ECL:277044.277165graphcoloring

\insertRef

Hertz:1987:UTS:44141.44146graphcoloring

See Also

color_graph()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(tidygraph)

if (requireNamespace("sf", quietly = TRUE) && requireNamespace("USAboundaries", quietly = TRUE)) {
 library(sf)
 library(USAboundaries)

 us_states() %>%
   filter(!(name %in% c("Alaska", "District of Columbia", "Hawaii", "Puerto Rico"))) %>%
   transmute(
     color = st_intersects(.) %>%
       graph_coloring_dsatur() %>%
       as.factor()
     ) %>%
   plot()
}

saurfang/graphcoloring documentation built on Jan. 19, 2020, 5:01 a.m.