rigraph icon indicating copy to clipboard operation
rigraph copied to clipboard

Nice to have: Plot self-loops so that they face away from other edges

Open clpippel opened this issue 3 years ago • 2 comments

What is the feature or improvement you would like to see? In layout_in_circle: always plot self edges outside the circle.

Use cases for the feature Example.

# Berger/circle schedule for round robin tournaments
n <- 32
n <- max(n - !(n %%2L), 1)
r <- c(rbind((seq(from = 0, to = -(n+1)/2+1) %% n) , seq(from=0, to=(n-1)/2)))  # diagonal in Zn
g <- make_graph(r+1)
  
for (i in seq_len(n-1)) {
   r <- ((r+(n-1)/2) %% n)
   g <- add_edges(g, r+1)
 }
 plot(g, layout=layout_in_circle)

For n = 8, the self-edges within the circle are visible. For larger n, the edges become unrecognizable.

layout_in_circle_self_edges

References

clpippel avatar Jul 29 '22 09:07 clpippel

I would rephrase this as: plot self-loops in such a way that they face away from other incident edges. It should not be specific to layout_in_circle. Mathematica does this, see e.g.:

image image

This should be done after #407 is fixed.

szhorvat avatar Jul 29 '22 10:07 szhorvat

See R automated procedure for placement of loops in network graphs for a workaround using ggraph.

clpippel avatar Jun 06 '23 08:06 clpippel