You should plot the graph with curved edges. Note that in plot()
, you curve with edge.curved
, but edge-attributes to individually curve edges should be curved
only.
The below function curve.reciprocal.edges()
I wrote after finding this answer by Sacha Epskamp who apparently has written a package, qgraph
, which you might find useful to explore if your needs exceed what can be achieved by this:
require(igraph)
e <- c(1,2, 2,3, 3,1, 3,4 , 4,1 , 2,1)
g <- graph(e, n=5, directed = TRUE)
curve.reciprocal.edges <- function(g, curve=.3){
# Return a graph where the edge-attribute $curved is reset to highlight reciprocal edges
el <- t(apply(get.edgelist(g),1,sort))
E(g)$curved <- 0
E(g)[duplicated(el) | duplicated(el,fromLast =TRUE)]$curved <- curve
(g)
}
plot(g, layout=layout.circle, edge.curved=.2)
plot(curve.reciprocal.edges(g), layout=layout.circle)
edge.curved=rep(0.5, ecount(g))
which makes curved edges but I would like them straight. – CaffeRistrettoe <- c(1,2, 2,3, 3,1, 3,4 , 4,1 , 2,1)
there is edge from 1 to 2 (first two) and also from 2 to 1 (last two). Or what do you mean by directional edges? – CaffeRistrettoedge.curved
. You can set it to 0.0 for "single" edges and 0.5 for edges that exist in both directions. – Tamás