tidygraph

A tidy API for graph manipulation

https://github.com/thomasp85/tidygraph

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.3%) to scientific vocabulary

Keywords

graph-algorithms graph-manipulation igraph network-analysis r tidyverse

Keywords from Contributors

tidy-data setup ggplot-extension data-manipulation grammar shiny strings visualisation rmarkdown package-creation
Last synced: 6 months ago · JSON representation

Repository

A tidy API for graph manipulation

Basic Info
Statistics
  • Stars: 558
  • Watchers: 22
  • Forks: 61
  • Open Issues: 32
  • Releases: 6
Topics
graph-algorithms graph-manipulation igraph network-analysis r tidyverse
Created almost 9 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Code of conduct

README.Rmd

---
output: github_document
---



```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
set.seed(1)
```

# tidygraph 


[![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)
[![CRAN_Release_Badge](http://www.r-pkg.org/badges/version-ago/tidygraph)](https://CRAN.R-project.org/package=tidygraph)
[![CRAN_Download_Badge](http://cranlogs.r-pkg.org/badges/tidygraph)](https://CRAN.R-project.org/package=tidygraph)
[![Coverage Status](https://codecov.io/gh/thomasp85/tidygraph/branch/main/graph/badge.svg)](https://app.codecov.io/gh/thomasp85/tidygraph?branch=main)


This package provides a tidy API for graph/network manipulation. While network 
data itself is not tidy, it can be envisioned as two tidy tables, one for node
data and one for edge data. `tidygraph` provides a way to switch between the two
tables and provides `dplyr` verbs for manipulating them. Furthermore it provides
access to a lot of graph algorithms with return values that facilitate their
use in a tidy workflow.

## An example
```{r, message=FALSE}
library(tidygraph)

play_gnp(10, 0.5) %>% 
  activate(nodes) %>% 
  mutate(degree = centrality_degree()) %>% 
  activate(edges) %>% 
  mutate(centrality = centrality_edge_betweenness()) %>% 
  arrange(centrality)
```

## Overview
`tidygraph` is a huge package that exports 280 different functions and methods.
It more or less wraps the full functionality of `igraph` in a tidy API giving 
you access to almost all of the `dplyr` verbs plus a few more, developed for use 
with relational data.

### More verbs
`tidygraph` adds some extra verbs for specific use in network analysis and 
manipulation. The `activate()` function defines whether one is manipulating node or edge
data at the moment as shown in the example above. `bind_edges()`, `bind_nodes()`,
and `bind_graphs()` let you expand the graph structure you're working with,
while `graph_join()` lets you merge two graphs on some node identifier. 
`reroute()`, on the other hand, lets you change the terminal nodes of the edges in
the graph.

### More algorithms
`tidygraph` wraps almost all of the graph algorithms from `igraph` and provides a 
consistent interface and output that always matches the sequence of nodes and 
edges. All `tidygraph` algorithm wrappers are intended for use inside verbs 
where they know the context they are being called in. In the example above it is
not necessary to supply the graph nor the node/edge IDs to `centrality_degree()`
and `centrality_edge_betweenness()` as they are aware of them already. This 
leads to much clearer code and less typing.

### More maps
`tidygraph` goes beyond `dplyr` and also implements graph centric version of the
`purrr` map functions. You can now call a function on the nodes in the order of
a breadth or depth first search while getting access to the result of the 
previous calls.

### More morphs
`tidygraph` lets you temporarily change the representation of your graph, do
some manipulation of the node and edge data, and then change back to the
original graph with the changes being merged in automatically. This is powered
by the new `morph()`/`unmorph()` verbs that let you e.g. contract nodes, work on
the linegraph representation, split communities to separate graphs etc. If you
wish to continue with the morphed version, the `crystallise()` verb lets you
*freeze* the temporary representation into a proper `tbl_graph`.

### More data structure support
While `tidygraph` is powered by igraph underneath it wants everyone to join the
fun. The `as_tbl_graph()` function can easily convert relational data from all
your favourite objects, such as `network`, `phylo`, `dendrogram`, `data.tree`,
`graph`, etc. More conversion will be added in the order I become aware of them.

## Visualisation
`tidygraph` itself does not provide any means of visualisation, but it works
flawlessly with `ggraph`. This division makes it easy to develop the 
visualisation and manipulation code at different speeds depending on where the
needs arise.

## Installation
`tidygraph` is available on CRAN and can be installed simply, using 
`install.packages('tidygraph')`. For the development version available on GitHub,
use the `devtools` package for installation:

```{r, eval=FALSE}
# install.packages('pak')
pak::pak('thomasp85/tidygraph')
```

## Thanks
`tidygraph` stands on the shoulders of particularly the `igraph` and 
`dplyr`/`tidyverse` teams. It would not have happened without them, so thanks so
much to them.

## Code of Conduct
Please note that the tidygraph project is released with a 
[Contributor Code of Conduct](https://tidygraph.data-imaginist.com/CODE_OF_CONDUCT.html). 
By contributing to this project, you agree to abide by its terms.

Owner

  • Name: Thomas Lin Pedersen
  • Login: thomasp85
  • Kind: user
  • Location: Copenhagen
  • Company: @posit-pbc, part of @tidyverse team

Maker of tools focusing on data science and data visualisation

GitHub Events

Total
  • Issues event: 2
  • Watch event: 13
  • Issue comment event: 5
  • Push event: 2
  • Pull request event: 2
Last Year
  • Issues event: 2
  • Watch event: 13
  • Issue comment event: 5
  • Push event: 2
  • Pull request event: 2

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 317
  • Total Committers: 21
  • Avg Commits per committer: 15.095
  • Development Distribution Score (DDS): 0.063
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Thomas Lin Pedersen t****5@g****m 297
Andrew Collier a****w@e****z 1
Andrea Gilardi a****i@u****t 1
Christian Mongeau c****u 1
David Schoch d****d@s****t 1
Eros Fabrici e****i@g****m 1
Florent Pezet f****t@o****r 1
JJ Chen j****n@g****m 1
JamesM131 j****1@g****m 1
Jeremy Foote j****1@g****m 1
Jon Calder j****r@g****m 1
Kirill Müller k****r 1
Lionel Henry l****y@g****m 1
Luis de Sousa l****d@s****a 1
Malcolm Barrett m****t 1
Maëlle Salmon m****n@y****e 1
Michael Chirico m****4@g****m 1
Olly Beagley 5****y 1
Richard Paquin Morel 3****l 1
Robert M Flight r****9@g****m 1
Romain François r****n@p****t 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 116
  • Total pull requests: 24
  • Average time to close issues: over 1 year
  • Average time to close pull requests: 12 months
  • Total issue authors: 67
  • Total pull request authors: 22
  • Average comments per issue: 1.69
  • Average comments per pull request: 2.21
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 3
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 2 hours
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 1.5
  • Average comments per pull request: 0.33
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • thomasp85 (19)
  • mkoohafkan (7)
  • alexpghayes (3)
  • chadbot (3)
  • nick-youngblut (3)
  • randomgambit (3)
  • szhorvat (3)
  • jdfoote (3)
  • gvdr (2)
  • artxz (2)
  • gi0na (2)
  • idshklein (2)
  • dmi3kno (2)
  • hughjonesd (2)
  • luukvdmeer (2)
Pull Request Authors
  • pearsonca (2)
  • thomasp85 (2)
  • schochastics (2)
  • krlmlr (2)
  • gi0na (2)
  • lionel- (1)
  • luisdza (1)
  • mkoohafkan (1)
  • grasshoppermouse (1)
  • MichaelChirico (1)
  • jameelalsalam (1)
  • llrs (1)
  • dmi3kno (1)
  • mdsumner (1)
  • rmflight (1)
Top Labels
Issue Labels
feature (17) bug (5) documentation (1)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 50,679 last-month
  • Total docker downloads: 60,944
  • Total dependent packages: 61
    (may contain duplicates)
  • Total dependent repositories: 222
    (may contain duplicates)
  • Total versions: 22
  • Total maintainers: 1
cran.r-project.org: tidygraph

A Tidy API for Graph Manipulation

  • Versions: 10
  • Dependent Packages: 58
  • Dependent Repositories: 215
  • Downloads: 50,679 Last month
  • Docker Downloads: 60,944
Rankings
Stargazers count: 0.7%
Dependent repos count: 1.2%
Forks count: 1.3%
Downloads: 1.3%
Dependent packages count: 1.5%
Average: 3.9%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/thomasp85/tidygraph
  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 9.0%
Average: 9.6%
Dependent repos count: 10.2%
Last synced: 6 months ago
conda-forge.org: r-tidygraph
  • Versions: 6
  • Dependent Packages: 3
  • Dependent Repositories: 7
Rankings
Dependent repos count: 12.9%
Dependent packages count: 15.6%
Stargazers count: 17.4%
Average: 17.8%
Forks count: 25.0%
Last synced: 6 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R6 * imports
  • cli * imports
  • dplyr >= 0.8.5 imports
  • igraph * imports
  • magrittr * imports
  • pillar * imports
  • rlang * imports
  • stats * imports
  • tibble * imports
  • tidyr * imports
  • tools * imports
  • utils * imports
  • NetSwan * suggests
  • ape * suggests
  • covr * suggests
  • data.tree * suggests
  • graph * suggests
  • influenceR * suggests
  • methods * suggests
  • netrankr * suggests
  • network * suggests
  • seriation * suggests
  • testthat * suggests