igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] add vertex label shortest path


From: joe j
Subject: Re: [igraph] add vertex label shortest path
Date: Thu, 30 Jun 2011 10:55:46 +0200

Thanks a lot, Tamas! It worked.
J.

On Thu, Jun 30, 2011 at 10:38 AM, Tamas Nepusz <address@hidden> wrote:
> Hi Joe,
>
> Assuming that your graph is y and it has a "name" attribute containing the
> vertex names, V(y)$name gives you the name of each vertex. You can then
> index this list with the first column of y_s to remap the indices to names:
>
> y_s[,1] <- V(y)$name[y_s[,1]]
>
> Similarly for the second column:
>
> y_s[,2] <- V(y)$name[y_s[,2]]
>
> --
> T.
>
> On 06/29/2011 02:52 PM, joe j wrote:
>> #code for generating shortest path matrix and creating a 3 columns
>> y_s<-shortest.paths(y,  weights = NULL)
>> y_s <- melt(y_s)[melt(upper.tri(y_s))$value,]
>> names(y_s) <- c("vertex1", "vertex2", "shortestpath")
>>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]