Skip to content
Back to skills

Tidygraph

ASecurity

R tidygraph package for tidy graph manipulation. Use for dplyr-style operations on network data.

  • 5 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 4, 2026
datanodeapi

Works with

  • api

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill tidygraph --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tidygraph?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tidygraph
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-tidygraph/badge)](https://www.skillsdirectory.com/skills/leolin990405-tidygraph)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tidygraph
description: R tidygraph package for tidy graph manipulation. Use for dplyr-style operations on network data.
---

# tidygraph Package

Tidy API for graph/network manipulation.

## Create Graph

```r
library(tidygraph)

# From data frames
graph <- tbl_graph(nodes = nodes_df, edges = edges_df)

# From igraph
graph <- as_tbl_graph(igraph_obj)

# Built-in graphs
graph <- play_erdos_renyi(100, 0.1)
graph <- create_ring(10)
graph <- create_tree(15, 2)
```

## Activate Context

```r
# Switch between nodes and edges
graph %>%
  activate(nodes) %>%
  mutate(degree = centrality_degree())

graph %>%
  activate(edges) %>%
  filter(weight > 0.5)
```

## Node Operations

```r
graph %>%
  activate(nodes) %>%
  mutate(
    degree = centrality_degree(),
    betweenness = centrality_betweenness(),
    pagerank = centrality_pagerank(),
    community = group_louvain()
  ) %>%
  filter(degree > 5) %>%
  arrange(desc(betweenness))
```

## Edge Operations

```r
graph %>%
  activate(edges) %>%
  mutate(
    centrality = centrality_edge_betweenness()
  ) %>%
  filter(!edge_is_multiple()) %>%
  arrange(desc(weight))
```

## Graph Operations

```r
# Convert
graph %>% to_undirected()
graph %>% to_simple()

# Subgraph
graph %>%
  activate(nodes) %>%
  filter(group == 1) %>%
  activate(edges) %>%
  filter(!edge_is_incident(node_is_isolated()))
```

## Morphing

```r
# Temporarily change structure
graph %>%
  morph(to_components) %>%
  mutate(comp_size = graph_order()) %>%
  unmorph()

# Other morphs
to_subgraph()
to_contracted()
to_linegraph()
```

## With ggraph

```r
library(ggraph)

graph %>%
  ggraph(layout = "fr") +
  geom_edge_link() +
  geom_node_point(aes(size = degree))
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.