[R] [igraph] Counting edges for each vertex

Mulone mulone at rome.com
Sat Jun 15 20:00:49 CEST 2013


Hi all,

I'm analysing an e-mail network. I loaded the following information in a
directed igraph:

*Vertex* types: person, e-mail
V(g)[ type == "person" ]
V(g)[ type == "email" ]

*Edge* types: sends, receives
E(g)[ type == "send" ]
E(g)[ type == "receive" ]

So for example:

John --send--> email1 --receive--> Mary
John --send--> email2 --receive--> Mary
Mary --send--> email3 --receive--> John

I would like to generate a summary of the e-mail activity, with edges with
an attribute representing the number of emails:

John --2--> Mary
Mary --1--> John

I tried to do this, but I haven't figured it out yet.
I managed to get in/out edges for each letter, but then I don't know what to
do to hold a count.

  lapply(V(g)[type=="email"],
    function(e){
      outedges = V(g) [ from(e) ]
      print(outedges)
      inedges = V(g) [ to(e) ]
      print(inedges)
    })

I just started using igraph, and I find even basic operations quite
difficult to carry out. :-/
How would I go about to do that?

Thanks,
Mulone



--
View this message in context: http://r.789695.n4.nabble.com/igraph-Counting-edges-for-each-vertex-tp4669613.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list