Questions tagged [tidygraph]

Tidygraph provides a tidy framework in R for all things relational (networks/graphs, trees, etc.). It is often used alongside ggraph.

102 questions
3
votes
0 answers

R ggraph remove isolates when facet_edges specified

I am doing some exploratory network analysis with the tidygraph package. I am trying to produce a faceted plot with my data using ggraph package. I created 2 different tbl_graph objects, which I bound together using the bind_graphs function. The…
Filippo Santi
  • 109
  • 1
  • 8
3
votes
1 answer

selectively color/size nodes in ggraph

I'm using tidygraph and ggraph to plot a network. Is there a way to selectively manipulate nodes? Specifically, size and color, separately. # example data rstat_nodes <- data.frame(name = c("Hadley", "David", "Romain", "Julia")) rstat_edges…
ecology
  • 606
  • 3
  • 9
  • 29
3
votes
2 answers

Mutate value by using a value from a different row in a tibble

I want to calculate the distance a node to the root dtr. All I have is a vector, that contains the parent node id for each node rel (in this example id == 7 is root): library(tidyverse) tmp <- tibble( id = 1:12, rel =…
Paavo Pohndorff
  • 323
  • 1
  • 2
  • 17
2
votes
1 answer

Colouring nodes using graph and tidygraph in R?

I recently asked this question about how to colour nodes by variable. And the code works great. However, I'm back trying to colour the terminal nodes separately. For example, if I create some data, then turn them into tidygraph objects and plot them…
Electrino
  • 2,636
  • 3
  • 18
  • 40
2
votes
1 answer

Create a network of unconnected, very small, full connected components

My final aim would be an undirected edgelist of this kind: Per a network of 3 components, full connected, one with 1 node, one with 2 nodes, one with 3 nodes: There would be 6 nodes, but since the first component is made only of 1 node, node1 has no…
GiulioGCantone
  • 195
  • 1
  • 10
2
votes
1 answer

Count the frequency of identical columns in a list of tidygraph objects in R?

I have a some tidygraph objects contained in a list. I am trying to count the frequency of columns (within the tidygraph nodes data) that are identical. For example, if I create some nodes and edge data, turn them into tidygraph objects, and put…
Electrino
  • 2,636
  • 3
  • 18
  • 40
2
votes
1 answer

R: Return list of edges of all simple paths

I am trying to obtain edge lists of paths between two nodes using tidygraph. Here is an example demo <- tbl_graph(nodes = tibble(name = c("A", "B", "C", "D")), edges = tribble(~from, ~to,~id, …
Qzhao
  • 57
  • 3
2
votes
1 answer

multiple different sized plots in same window in R?

Similar questions have been asked many times, for example here and here. However, all of the other answers I have seen so far don't really solve my problem. I am trying to plot multiple different sized plots in the same window. I am working with…
Electrino
  • 2,636
  • 3
  • 18
  • 40
2
votes
2 answers

How to manipulate a tidygraph object from a list of tidygraph objects inR?

If I have a list of tidygraph objects, I want to remove list elements based on some condition. For example, if I have a list of tidy graph object, like so: nodes <- data.frame(name = c("Hadley", "David", "Romain", "Julia")) edges <- data.frame(from…
Electrino
  • 2,636
  • 3
  • 18
  • 40
2
votes
0 answers

Sequencing of river network calculation using sfnetworks and r

I’ve got a rooted tree setup in sfnetworks. It is derived from a line shapefile of a stream network. For each tributary in the stream network, there are obviously start and end nodes which sfnetworks determines, but there are also nodes connecting…
Scott R
  • 21
  • 3
2
votes
3 answers

How to construct an edgeliste from a list of visited places (effectively)?

My original data.table consists of three columns. site, observation_number and id. E.g. the following which is all the observations for id = z |site|observation_number|id |a | 1| z |b | 2| z |c …
Andreas
  • 6,612
  • 14
  • 59
  • 69
2
votes
1 answer

Adding an attribute column to a tidygraph object

I am trying to figure out how to add attribute data to a tidygraph object specifically for plotting purposes. I can't seem to figure out how take a variable which is associated with a variable level, preserve it when I create a tidygraph object for…
boshek
  • 4,100
  • 1
  • 31
  • 55
2
votes
2 answers

Co-occurence networks using presence/absence data R

I am trying to make a co-occurence network graph for my presence/absence data of bacteria species but am unsure how to go about with it. I'm hoping to end up with something like this enter image description herewhere each species is linked to…
J.Dyer
  • 23
  • 4
2
votes
0 answers

Random Graph Function in R

I have an assignment in which I have to generate my own random graph function in R, with an igraph output. I've figured out that the easiest way to do this is to simply generate a square matrix and then build a function which creates edges between…
Petrus
  • 65
  • 7
2
votes
1 answer

3D pipe/tube plots in R - creating plots of tree roots

I'm trying to create 3D plots of simulated tree roots in R. Here is an example of a root system growing over time: This is essentially a 3D network of cylinders, where the cylinder diameter (and, optionally, color) represents the size of the root.…
Kevin
  • 491
  • 3
  • 10