R interface: Confused about curved parameter

Bug #517697 reported by Keith Ponting
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
igraph
Fix Released
High
Gábor Csárdi

Bug Description

Attempting to draw a grap with some loop edges and the rest curved, I specified a curved parameter of length the total number of edges. When it gets to the following call in plot.igraph, the lengths of curved and x0 are different (20 and 16 in my case).
      igraph.Arrows(x0, y0, x1, y1, h.col=edge.color, sh.col=edge.color,
                    sh.lwd=edge.width, h.lwd=1, open=FALSE, code=arrow.mode,
                    sh.lty=edge.lty, h.lty=1, size=arrow.size,
                    width=arrow.width, curved=curved)
Should I specify curved only for the non-loop edges (which feels inconsistent, as everything else is one value per edge), or does the code need an extra line like the following inside the if test just before the above call?
    if (length(curved)>1) { curved <- curved[nonloops.e] }

igraph 0.5.3, R 2.10.0 patched, Windows Vista. - transcript is:

> nodes <- data.frame(name=c("sv","su","nsv","nsuv","Osv","Osu","Onsv","Onsuv"),
+ color=c(rep(NA,4),rep("grey",4)),
+ frame.color=rep("black",8),
+ shape=c(rep("circle",4),rep("circle",4)),
+ label=c("s,v","s,u","ns,v","ns,uv"),
+ x=c(rep(-1:0,2),rep(-1:0,2)),
+ y=c(rep(1:0,each=2),rep(1:0-0.25,each=2)))
> nn <- as.character(nodes$name)
> edges <- data.frame(from=c(nn[1:4],rep(nn[1:4],each=4)),
+ to=c(nn[5:8],rep(nn[1:4],4)),
+ loop.angle=c(rep(90,12),rep(180,4),rep(0,4)),
+ curved=c(rep(0,4),rep(0.3,16)),
+ lty=rep(1,20),
+ color=rep("darkgrey",20))
> gg <- graph.data.frame(edges,directed=TRUE,vertices=nodes)
> plot(gg,layout=as.matrix(subset(nodes,select=c(x,y))),rescale=TRUE)
Error in lambda * 1/2 * (c.y2 - c.y1) :
  (converted from warning) longer object length is not a multiple of shorter object length
>

Thankyou,

Keith Ponting

Changed in igraph:
importance: Undecided → High
status: New → Confirmed
Changed in igraph:
assignee: nobody → Gábor Csárdi (gabor.csardi)
Revision history for this message
Gábor Csárdi (gabor.csardi) wrote :

Yep, exactly, I have added that line, and it works fine. Fixed in revision #1574 (0.5-main) and #1763 (0.6-main).

Thanks for the detailed report!

Changed in igraph:
status: Confirmed → Fix Released
Revision history for this message
Gábor Csárdi (gabor.csardi) wrote : Continue on github

The development of igraph has moved to github, so please do not comment on this bug here. You are of course welcome to comment on github, here:
https://github.com/igraph/igraph/issues/58

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.