Tidygraph provides a tidy framework in R for all things relational (networks/graphs, trees, etc.). It is often used alongside ggraph.
Questions tagged [tidygraph]
102 questions
1
vote
2 answers
Count edges of a given type for each node with tidygraph
Objective: I want to count the number of incoming edges of a partial type for each node. How can I do that?
Criteria:
I need to use the R package tidygraph
Answers that allow me to mutate an existing graph via a magrittr pipeline are better
Fewer…

Ian Cero
- 360
- 1
- 8
1
vote
1 answer
Controling arc position (up or down) in linear ggraph arcplot
Background
I have a network of nodes and edges which I would like to visualize as a linear arcplot. Based on my limited knowledge, I believe that {ggraph} is a good tool for this (especially given my familiarity with {ggplot2}) so that's what I'm…

Dan Adams
- 4,971
- 9
- 28
1
vote
1 answer
Group ID for all edges between points using sfnetwork in r
I have a rooted tree with spatially explicit edges (ln_sfnetwork) with additional edges created by adding a point layer (pt).
I would like to give all of the edges between each point on the network the same ID so I can calculate the total length of…

Josh J
- 395
- 1
- 3
- 13
1
vote
1 answer
Define and categorise separate networks in R
I have an issue that I've been unable to optimise and I'm sure that either igraph or tidy graphs must hold this function already or there must be a better way to do this. I am using R and igraph to do this but possibly tidygraphs would also do the…

rwhit
- 45
- 6
1
vote
1 answer
Adding spatially explicit edges to sfnetwork
I have an sfnetwork in R with spatially implicit edges. I would like to plot it using tmap, and therefore I would like to make the edges spatially explicit, by just turning them into lines.
I created this monstrosity to do it
edges <-…

Anaphory
- 6,045
- 4
- 37
- 68
1
vote
1 answer
Map directed edge attribute to scale_edge_color_gradient aes in ggraph
I'm learning to use tidygraph and ggraph to plot social network data. I like it so far, but I can't figure out how to use color gradients to indicate edge direction while also mapping the color (that the gradient is based on) to an edge…

jmaec
- 11
- 1
1
vote
0 answers
How to fix invalid vertex id error in tidygraph?
Data
network_data <- list(nodes = structure(list(id = c(0, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14), label = c("2892056", "2894543", "2894544",
"2894545", "2894546", "2894547", "2894548", "2894549", "2894550",
"2894551", "2894552",…

user1828605
- 1,723
- 1
- 24
- 63
1
vote
1 answer
Number of Connected Nodes in a dendrogram
Just started working with the tidygraph and ggraph packages recently and have a relatively simple problem, though, oddly, cannot seem to find an easy solution. Within a network, how many nodes are connected down from a single parent? Would seem to…

James Crumpler
- 192
- 1
- 8
1
vote
1 answer
List to hierarchical graph
Is there an elegant way to convert an R list such as..
x = list(
`People who` = list(
`believe in aliens` = list(
`believe aliens visit/visited Earth` = 5,
`believe in aliens elsewhere in universe` = 45
),
`do not believe…

geotheory
- 22,624
- 29
- 119
- 196
1
vote
1 answer
How to detach nodes and edge part of a tidygraph tibble into two separate pure tibbles
I have the following tidygraph tibble:
rstat_nodes <- data.frame(name = c("Hadley", "David", "Romain", "Julia"), sex = c("M","M","M","F"))
rstat_edges <- data.frame(from = c(1, 1, 1, 2, 3, 3, 4, 4, 4),
to = c(2, 3, 4, 1,…

littleworth
- 4,781
- 6
- 42
- 76
1
vote
1 answer
How to color edges according to node communities?
How can I add color information to edges in a tbl_graph ? I would like to color edges according to the color of the 'to' and 'from' nodes : if both nodes have the same color, then the edge between them should get the same…

user1788720
- 327
- 2
- 11
1
vote
1 answer
How to get tree nodes to nest properly in tree.map
I am having trouble building a tree.map from parent/child grouped pairs. Here's my sample data:
SubjectID <- c('101','101','101','102','103','103','103')
parent <- c(1387, 1620, 1743,986,1623,1191,1450)
child <- c(1620,1743,1859…

user2909302
- 103
- 8
1
vote
0 answers
Creating a circular/concentric bipartite graph in r
SOLVED: see my solution, added at the bottom of the post.
I am currently trying to create a circular bipartite graph using r, ideally with ggraph. I have a dataset of mating relationships between male and female frogs; here is a subset of that…

meganbarkdull
- 23
- 4
1
vote
1 answer
Using tidygraph to derive nodes and graph-level metrics per group
I am trying out tidygraph on networks coming from different experimental treatments and am mostly interested to get out graph-wide metrics and potentially also node-level metrics. I can't seem to be able to get my head around the way tidygraph…

Lionel
- 73
- 2
- 6
1
vote
1 answer
Tidygraph: calculate child summaries at parent level
using the tidygraph package in R, given a tree, I'd like to calculate the mean, sum, variance... of a value for each of the direct children of each node in the tree.
My intuition is to use map_bfs_back_dbl or related and have tried modifying the…

schnee
- 1,050
- 2
- 9
- 20