igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] help finding edge connecting two nodes


From: Gábor Csárdi
Subject: Re: [igraph] help finding edge connecting two nodes
Date: Thu, 18 Oct 2012 20:12:05 -0400

Hi,

this is actually quite easy in igraph 0.6 and above, because you can
use the graph as if it was an adjacency matrix (or weighed adjacency
matrix in your case):

library(igraph)
g <- graph.ring(10)
g[1,2]
E(g)$weight <- runif(ecount(g))
g[1,2]

Please see ?"[.igraph" for more.

Gabor

On Thu, Oct 18, 2012 at 6:02 PM, Dhaval Adjodah <address@hidden> wrote:
> I'm new to R and igraph and I was wondering if anybody can help me with the
> following.
>
> I want to find the edge weight between two vertices in a graph. My graph
> structure is defined by the normal ego (node1), alter (node2) and the weight
> of the edge between them.
>
> I know that I can get the weight for each of the edges in the list of edges
> that originate from node number 5 using E(igraph_friendship) [ from(5)
> ]$weight And that I can find the weight for each of the edges in the list of
> edges that end onto node number 10 using E(igraph_friendship) [ to(10)
> ]$weight
>
> But what if I simply want to find the weight of the edge that simple
> connects just node 5 and node 10?
>
> Alternatively, if I can get the identifier of the edge that connects node 5
> and 10 in the list of all edges,E(igraph_friendship), that would work too.
>
> Thanks a lot for your help, I've been looking around a lot for it and I
> really appreciate your help!
>
> Dhaval
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     MTA KFKI RMKI



reply via email to

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