{"id":13401459,"url":"https://github.com/thomasp85/tidygraph","last_synced_at":"2025-05-14T08:09:30.043Z","repository":{"id":37493462,"uuid":"84092668","full_name":"thomasp85/tidygraph","owner":"thomasp85","description":"A tidy API for graph manipulation","archived":false,"fork":false,"pushed_at":"2025-02-05T21:43:32.000Z","size":30499,"stargazers_count":554,"open_issues_count":32,"forks_count":61,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-04-11T02:52:03.734Z","etag":null,"topics":["graph-algorithms","graph-manipulation","igraph","network-analysis","r","tidyverse"],"latest_commit_sha":null,"homepage":"https://tidygraph.data-imaginist.com","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/thomasp85.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"2017-03-06T16:00:51.000Z","updated_at":"2025-03-22T11:15:52.000Z","dependencies_parsed_at":"2023-02-17T22:30:27.742Z","dependency_job_id":"c0d753e0-fc6a-4289-a6ee-35fb3f0c686d","html_url":"https://github.com/thomasp85/tidygraph","commit_stats":{"total_commits":251,"total_committers":18,"mean_commits":"13.944444444444445","dds":0.0677290836653387,"last_synced_commit":"8de2ac208100092e5bb21f3f9c037e73acddc6c0"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Ftidygraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Ftidygraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Ftidygraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Ftidygraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasp85","download_url":"https://codeload.github.com/thomasp85/tidygraph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253645441,"owners_count":21941315,"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-manipulation","igraph","network-analysis","r","tidyverse"],"created_at":"2024-07-30T19:01:02.885Z","updated_at":"2025-05-14T08:09:25.036Z","avatar_url":"https://github.com/thomasp85.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\nset.seed(1)\n```\n\n# tidygraph \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"140px\"/\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/thomasp85/tidygraph/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/thomasp85/tidygraph/actions/workflows/R-CMD-check.yaml)\n[![CRAN_Release_Badge](http://www.r-pkg.org/badges/version-ago/tidygraph)](https://CRAN.R-project.org/package=tidygraph)\n[![CRAN_Download_Badge](http://cranlogs.r-pkg.org/badges/tidygraph)](https://CRAN.R-project.org/package=tidygraph)\n[![Coverage Status](https://codecov.io/gh/thomasp85/tidygraph/branch/main/graph/badge.svg)](https://app.codecov.io/gh/thomasp85/tidygraph?branch=main)\n\u003c!-- badges: end --\u003e\n\nThis package provides a tidy API for graph/network manipulation. While network \ndata itself is not tidy, it can be envisioned as two tidy tables, one for node\ndata and one for edge data. `tidygraph` provides a way to switch between the two\ntables and provides `dplyr` verbs for manipulating them. Furthermore it provides\naccess to a lot of graph algorithms with return values that facilitate their\nuse in a tidy workflow.\n\n## An example\n```{r, message=FALSE}\nlibrary(tidygraph)\n\nplay_gnp(10, 0.5) %\u003e% \n  activate(nodes) %\u003e% \n  mutate(degree = centrality_degree()) %\u003e% \n  activate(edges) %\u003e% \n  mutate(centrality = centrality_edge_betweenness()) %\u003e% \n  arrange(centrality)\n```\n\n## Overview\n`tidygraph` is a huge package that exports 280 different functions and methods.\nIt more or less wraps the full functionality of `igraph` in a tidy API giving \nyou access to almost all of the `dplyr` verbs plus a few more, developed for use \nwith relational data.\n\n### More verbs\n`tidygraph` adds some extra verbs for specific use in network analysis and \nmanipulation. The `activate()` function defines whether one is manipulating node or edge\ndata at the moment as shown in the example above. `bind_edges()`, `bind_nodes()`,\nand `bind_graphs()` let you expand the graph structure you're working with,\nwhile `graph_join()` lets you merge two graphs on some node identifier. \n`reroute()`, on the other hand, lets you change the terminal nodes of the edges in\nthe graph.\n\n### More algorithms\n`tidygraph` wraps almost all of the graph algorithms from `igraph` and provides a \nconsistent interface and output that always matches the sequence of nodes and \nedges. All `tidygraph` algorithm wrappers are intended for use inside verbs \nwhere they know the context they are being called in. In the example above it is\nnot necessary to supply the graph nor the node/edge IDs to `centrality_degree()`\nand `centrality_edge_betweenness()` as they are aware of them already. This \nleads to much clearer code and less typing.\n\n### More maps\n`tidygraph` goes beyond `dplyr` and also implements graph centric version of the\n`purrr` map functions. You can now call a function on the nodes in the order of\na breadth or depth first search while getting access to the result of the \nprevious calls.\n\n### More morphs\n`tidygraph` lets you temporarily change the representation of your graph, do\nsome manipulation of the node and edge data, and then change back to the\noriginal graph with the changes being merged in automatically. This is powered\nby the new `morph()`/`unmorph()` verbs that let you e.g. contract nodes, work on\nthe linegraph representation, split communities to separate graphs etc. If you\nwish to continue with the morphed version, the `crystallise()` verb lets you\n*freeze* the temporary representation into a proper `tbl_graph`.\n\n### More data structure support\nWhile `tidygraph` is powered by igraph underneath it wants everyone to join the\nfun. The `as_tbl_graph()` function can easily convert relational data from all\nyour favourite objects, such as `network`, `phylo`, `dendrogram`, `data.tree`,\n`graph`, etc. More conversion will be added in the order I become aware of them.\n\n## Visualisation\n`tidygraph` itself does not provide any means of visualisation, but it works\nflawlessly with `ggraph`. This division makes it easy to develop the \nvisualisation and manipulation code at different speeds depending on where the\nneeds arise.\n\n## Installation\n`tidygraph` is available on CRAN and can be installed simply, using \n`install.packages('tidygraph')`. For the development version available on GitHub,\nuse the `devtools` package for installation:\n\n```{r, eval=FALSE}\n# install.packages('pak')\npak::pak('thomasp85/tidygraph')\n```\n\n## Thanks\n`tidygraph` stands on the shoulders of particularly the `igraph` and \n`dplyr`/`tidyverse` teams. It would not have happened without them, so thanks so\nmuch to them.\n\n## Code of Conduct\nPlease note that the tidygraph project is released with a \n[Contributor Code of Conduct](https://tidygraph.data-imaginist.com/CODE_OF_CONDUCT.html). \nBy contributing to this project, you agree to abide by its terms.\n","funding_links":[],"categories":["HTML","Network Analysis","R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasp85%2Ftidygraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasp85%2Ftidygraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasp85%2Ftidygraph/lists"}