edgebundleR icon indicating copy to clipboard operation
edgebundleR copied to clipboard

Feature Request: Ordering nodes

Open aliarsalankazmi opened this issue 8 years ago • 4 comments

Thank you for the great work, garthtarr and timelyportfolio!

I think it may be worth adding an order argument for the nodes. I think it will be a fairly common use case when one will have a lot of groups/classes in their data. Although they can colour these, but even if we have 5 groups of a thousand observations, it becomes difficult to spot patterns in the data.

Adding an order argument will be able to show if certain groups have intra/inter-groups linkage.

aliarsalankazmi avatar Mar 29 '16 17:03 aliarsalankazmi

@aliarsalankazmi yes indeed that would be useful. I don't have time right now to implement such a feature, hopefully I'll find some time in the next few months.

garthtarr avatar Mar 30 '16 02:03 garthtarr

As a start, I've disabled the automatic alphabetical ordering of the nodes. They should now maintain the order from the data that is passed through.

garthtarr avatar May 28 '16 05:05 garthtarr

Thanks!

aliarsalankazmi avatar Jun 26 '16 11:06 aliarsalankazmi

Hey @garthtarr, I just came across this great package, thank you!

Any update on the issue of node order? And when you say (in your answer on May 28, 2016 ) that the 2016 fix means 'they should now maintain the order from the data that is passed through.', what do you mean by the 'order that the data are passed through'? When I change the order of the rows in the data passed to graph.data.frame(), it doesn't change the order of the nodes in the final figure. Example code below - thanks for your help!


library(igraph)
library(edgebundleR)

# vertices
nodes <- 
  tibble("name" = letters[seq( from = 1, to = 10 )],
         "type" = c(rep("one", 5), rep("two", 5))
) %>%
  arrange(desc(type))

# relationsips
edges <- 
  nodes %>%
  select(from = name) %>%
  mutate(to = 
           case_when(from == "a" ~ "b",
                     from == "b" ~ "d",
                     TRUE ~ "g"))

# make igraph object 
g <- graph.data.frame(edges, directed=F, vertices=nodes)

# Plot
# ... is ordered a->h, not by 'type', i.e. f,g,h,i,j,a,b,c,d,e
edgebundle(g)

ErasmuszuE avatar Aug 17 '20 13:08 ErasmuszuE