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.

color_dsatur()

color_msc()

color_lmxrlf()

color_hybrid_lmxrlf_tabucol()

color_hybrid_dsatur_tabucol()

color_tabucol(k)

Arguments

k

number of colors to use for graph coloring

Functions

Examples

library(tidygraph)
#> #> Attaching package: ‘tidygraph’
#> The following object is masked from ‘package:testthat’: #> #> matches
#> The following object is masked from ‘package:stats’: #> #> filter
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("") }
#> Loading required package: ggplot2
#> Want to understand how all the pieces fit together? See the R for Data #> Science book: http://r4ds.had.co.nz/