color_graph: Color nodes using Graph Coloring Algorithm

Description Usage Arguments Functions Examples

Description

These functions are tidygraph wrapper around the various graph coloring algorithms. They automatically use the graph that is being computed on, and otherwise passes on its arguments to the relevant coloring function. The return value is always a integer vector of assigned color index so that neighboring nodes never share the same color.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

Arguments

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

Functions

Examples

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

if (requireNamespace("ggraph", quietly = TRUE)) {
  library(ggraph)
  set.seed(42)

  play_islands(5, 10, 0.8, 3) %>%
    mutate(color = as.factor(color_dsatur())) %>%
    ggraph(layout = 'kk') +
    geom_edge_link(aes(alpha = ..index..), show.legend = FALSE) +
    geom_node_point(aes(color = color), size = 7) +
    theme_graph("")
}

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