long-format node data in tidygraphs / longitudinal node wrapping


this is a cross post from a github issue I raised earlier. Probably better suited here.

I am trying to show the evolution of node data in a tbl_graph over time, i.e., I wanted to construct a tbl_graph with multiple rows per node in the node data set. However, I am struggling to get that to work and failed to find documentaiton on the feature - not sure whether it is possible then. Here is a brief example

tbl_graph(nodes = tibble(id = c("a", "a", "b", "b"), t = c(1, 2, 1, 2)), edges = tibble(from = "a", to = "b"), node_key = "id")
# A tbl_graph: 4 nodes and 1 edges
# A rooted forest with 3 trees
# Node Data: 4 x 2 (active)
  id        t
  <chr> <dbl>
1 a         1
2 a         2
3 b         1
4 b         2
# Edge Data: 1 x 2
   from    to
  <int> <int>
1     1     3

I expected a graph of two nodes ("a" and "b") with longitudinal information (t) in long format. It seems that the input is interpreted as a graph with four nodes (which would still be fine) but the edge data is incomplete (would expect an edge from 2 to 4). I was hoping to use this structure to show node data over time with facet_nodes(~t). Is long-format node data supported and if so, what am I missing?

original issue

Is it possible to realize longitudinal facetting of node data with ggraph?

as pointed out on GH, the underlying igraph structure indeed makes this impossible. Needs a workaround with additional nodes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.