igraph-help
[Top][All Lists]

## Re: [igraph] Vertex from an edge

 From: Gábor Csárdi Subject: Re: [igraph] Vertex from an edge Date: Thu, 18 Jun 2009 21:00:33 +0200

Then create an edge list first:

el2 <- el <- get.edgelist(g, names=FALSE)
el2[] <- V(g)\$attribute[ el+1 ]
rowSums(el2)

'el' is the edge list, 'el2' is a two-column matrix with the vertex attribute for each edge.

G.

On Thu, Jun 18, 2009 at 8:50 PM, Alvaro Graves Fuenzalida wrote:
Yes, but, I want to do something with each specific sum, so if I have nodes A, B and C with scores 1, 2 and 3 respectively and all connected I want to say that edge A-B is 2+1 = 3, edge B-C is 2+3=5 and edge A-C is 1+3=4

Gábor Csárdi wrote:
I mean the sum of this, i.e.

sum(degree(g) * V(g)\$attribute)

G.

On Thu, Jun 18, 2009 at 8:02 PM, Gábor Csárdi wrote:
Hi,

that is basically summing the attribute for each node as many times as the degree of the node, isn't it?

So it is just

degree(g) * V(g)\$attribute

Best,
Gabor

On Thu, Jun 18, 2009 at 7:38 PM, Alvaro Graves Fuenzalida wrote:
Hi,

I'm using the R version of igraph and a was wondering how to do the following: For each edge, I need to take the values of each node (stored in an node's attribute) and sum them but is not clear to me how to use the nodes from an edge. I assume is something related to E(g) but I couldn't find what other parameter.

_______________________________________________
igraph-help mailing list
http://lists.nongnu.org/mailman/listinfo/igraph-help

--

--

```
_______________________________________________
igraph-help mailing list
http://lists.nongnu.org/mailman/listinfo/igraph-help
```

_______________________________________________
igraph-help mailing list