I have an other question to: this topic
Is it in igraph possible to give other names for edges ("E1", "E2", "E3") than standart letters like "a","b","c"? And later create the shortest path output with them("E1","E2","E3")
Thank you ;)
Instead of using a name
attribute for the edges, and then specifying it in your plot statement, it would be better to use what igraph uses - the label
attribute.
library(igraph)
solid = graph_from_literal(A-D,A-C,D-F,D-C,C-B,B-E)
E(solid)$label <- paste0("E", seq_len(ecount(solid)))
plot(solid)
This will allow you to get at the shortest paths as well. The shortest_paths
function returns a structure that has the edgelist stored in $epath
. You can get the labels of the whole path from there
lapply(shortest_paths(solid, from='A', to ='F', output='epath')$epath,
function(x) { x$label })
[[1]]
[1] "E1" "E4"