Thanks, this is a known bug, it was fixed in our development tree. Here is a workaround function:
get.shortest.paths <- function(graph, from, to=V(graph),
mode=c("out", "all", "in"),
weights=NULL,
output=c("vpath", "epath", "both")) {
if (!is.igraph(graph)) {
stop("Not a graph object")
}
mode <- igraph:::igraph.match.arg(mode)
mode <- switch(mode, "out"=1, "in"=2, "all"=3)
ooutput <- igraph:::igraph.match.arg(output)
output <- switch(ooutput, "vpath"=0, "epath"=2, "both"=2)
if (is.null(weights)) {
if ("weight" %in% list.edge.attributes(graph)) {
weights <- as.numeric(E(graph)$weight)
}
} else {
if (length(weights)==1 &&
is.na(weights)) {
weights <- NULL
} else {
weights <- as.numeric(weights)
}
}
to <- igraph:::as.igraph.vs(graph, to)-1
on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
res <- .Call("R_igraph_get_shortest_paths", graph,
igraph:::as.igraph.vs(graph, from)-1, to, as.numeric(mode),
as.numeric(length(to)),
weights, as.numeric(output), PACKAGE="igraph")
if (output !=2 ) {
res <- lapply(res, function(x) x+1)
} else {
res <- list(vpath=lapply(res$vpath, function(x) x+1),
epath=lapply(res$epath, function(x) x+1))
}
if (ooutput == "epath") { res$epath } else { res }
}