{"id":17175673,"url":"https://github.com/saurfang/graphcoloring","last_synced_at":"2025-04-13T16:42:07.460Z","repository":{"id":79887703,"uuid":"149574814","full_name":"saurfang/graphcoloring","owner":"saurfang","description":"Graph Coloring Algorithms for tidygraph","archived":false,"fork":false,"pushed_at":"2020-01-18T20:06:02.000Z","size":1919,"stargazers_count":18,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T07:35:54.633Z","etag":null,"topics":["graph-algorithms","graph-coloring","map-coloring","tidygraph"],"latest_commit_sha":null,"homepage":"https://saurfang.github.io/graphcoloring/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saurfang.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-20T08:12:38.000Z","updated_at":"2024-11-19T18:48:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"86072e72-d831-4e08-95bc-60ae2cfde45f","html_url":"https://github.com/saurfang/graphcoloring","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurfang%2Fgraphcoloring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurfang%2Fgraphcoloring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurfang%2Fgraphcoloring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurfang%2Fgraphcoloring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saurfang","download_url":"https://codeload.github.com/saurfang/graphcoloring/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248747410,"owners_count":21155446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph-algorithms","graph-coloring","map-coloring","tidygraph"],"created_at":"2024-10-14T23:57:19.414Z","updated_at":"2025-04-13T16:42:07.455Z","avatar_url":"https://github.com/saurfang.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n# graphcoloring\n\n[![Travis build status](https://travis-ci.org/saurfang/graphcoloring.svg?branch=master)](https://travis-ci.org/saurfang/graphcoloring)\n[![CRAN status](https://www.r-pkg.org/badges/version/graphcoloring)](https://cran.r-project.org/package=graphcoloring)\n[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n[![Coverage status](https://codecov.io/gh/saurfang/graphcoloring/branch/master/graph/badge.svg)](https://codecov.io/github/saurfang/graphcoloring?branch=master)\n\n`graphcoloring` is a collection of graph coloring algorithms for coloring vertices of a graph such that no two adjacent vertices share the same color. The algorithms\nare included via the embedded 'GraphColoring' C++ library, \u003chttps://github.com/brrcrites/GraphColoring\u003e.\n\n## Installation\n\nYou can install the released version of graphcoloring from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"graphcoloring\")\n```\n\nDevelopment version can be installed with\n\n```r\ndevtools::install_github(\"saurfang/graphcoloring\")\n```\n\n## Example\n\n`color_*` functions operate under `tidygraph` family and can be used to color nodes within `mutate` context similar to `group_*` functions in `tidygraph`.\n\n```{r example, message=FALSE}\nlibrary(graphcoloring)\nlibrary(tidygraph)\nlibrary(ggraph)\n\nset.seed(42)\n\nplay_islands(5, 10, 0.8, 3) %\u003e%\n  mutate(color = as.factor(color_dsatur())) %\u003e%\n  ggraph(., layout = 'kk') +\n  geom_edge_link(aes(alpha = ..index..), show.legend = FALSE) +\n  geom_node_point(aes(color = color), size = 7) +\n  theme_graph()\n```\n\n`graph_coloring_*` functions directly take adjacency lists and returns an integer vector of assigned labels.\nFor example, this can be used with `sf::st_intersects()` to color a feature collection for visualization.\n\n```{r sf-example, message=FALSE}\nlibrary(graphcoloring)\nlibrary(USAboundaries)\nlibrary(sf)\nlibrary(ggplot2)\n\nset.seed(48)\n\nus_states() %\u003e%  \n  filter(!(name %in% c(\"Alaska\", \"District of Columbia\", \"Hawaii\", \"Puerto Rico\"))) %\u003e%\n  mutate(\n    color = st_intersects(.) %\u003e%\n      graph_coloring_dsatur() %\u003e%\n      as.factor()\n  ) %\u003e%\n  ggplot() +\n  geom_sf(aes(fill = color)) +\n  theme_bw()\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaurfang%2Fgraphcoloring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaurfang%2Fgraphcoloring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaurfang%2Fgraphcoloring/lists"}