Hi, e.g. this makes all edges along the paths red, the rest grey:

library(igraph)

data<-(c(0,1, 0,8, 0,9, 0,2, 1,3, 2,3, 4,5, 5,1, 6,2, 7,6))
g1 <- graph(data+1, directed=TRUE)
paths <- get.all.shortest.paths(g1, 1, 4)

E(g1)$color <- "grey"
for (p in paths$res) { E(g1, path=p)$color <- "red" }
plot(g1)

It works with igraph 0.7.x and above. If you have an older version leave
out $res in the for() line.

Gabor



On Thu, Jan 30, 2014 at 6:49 AM, Ragia Ibrahim <[email protected]> wrote:

> Dear members,
> I got a graph
> data<-(c(0,1, 0,8, 0,9, 0,2, 1,3, 2,3, 4,5, 5,1, 6,2, 7,6))
> g1 <- graph( data+1 , directed=TRUE )
>
>
> and i got all shortest paths
> paths<-get.all.shortest.paths( g1, 1, 4 )
>
>
> the paths contain:
>
> [[1]]
> [1] 1 3 4
>
> [[2]]
> [1] 1 2 4
>
> HOW CAN I plot them like a graph, nodes edges between them?
> shall  i convert each list item into edge list then concatenate them ?if so 
> how to write the parsing (reading) for?
>
> thanks in advance
> RAE
>
>
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to