|
From: | Ragia Ibrahim |
Subject: | Re: [igraph] plot shortest paths in one graph |
Date: | Wed, 5 Feb 2014 18:26:18 +0200 |
Many Thanks Gabor
Date: Wed, 5 Feb 2014 11:01:20 -0500 From: address@hidden To: address@hidden Subject: Re: [igraph] plot shortest paths in one graph 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 <address@hidden> wrote:
_______________________________________________ igraph-help mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/igraph-help |
[Prev in Thread] | Current Thread | [Next in Thread] |