[Top][All Lists]

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

Re: [igraph] correlation between attributes in bipartite network

From: Gábor Csárdi
Subject: Re: [igraph] correlation between attributes in bipartite network
Date: Thu, 31 Mar 2011 13:53:19 -0400

Simone, please keep threads on the list. Thanks.

On Tue, Mar 29, 2011 at 3:15 PM, Simone Gabbriellini
<address@hidden> wrote:
> Gabor,
> sorry for that, here attached you'll find my network. I am trying to 
> correlate:
> on the x-axis: names(table(degree(V(g)[type==0])))
> on the y-axis: the mean number of project over all nodes with that degree 
> where $invitedby[V(g)$type==0] == $startedby[V(g)$type==1]
> hope this can clarify what I have in my mind.

Maybe. Here is my interpretation. This is a bipartite network, type 0
means people, type 1 means projects. A connection means that a given
person participates in a given project. V(g)$invitedby gives who
invited a given person, for each type 0 node, and V(g)$startedby gives
who started a given project, for each type 1 node.

So what you want is peoples' degree on the horizontal axis. The mean
number of projects, for people with the given degree participate in,
is on the vertical axis, but we only count projects that were started
by someone that invited the given person. Right?

The projects people participate in:

peopleproj <- lapply(V(g)[type==0], neighbors, graph=g)

Degree of the people:

degpeople <- sapply(peopleproj, length)

For each person 'x', number of projects that were started by people
that invited 'x':

peopleids <- as.vector(V(g)[type==0])
numstbyinv <- sapply(seq_along(peopleids), function(idx) {
 x <- peopleids[idx]
 ib <- V(g)[x]$invitedby
 sb <- V(g)[peopleproj[[idx]]]$startedby

Finally, group people by degree:

res <- tapply(numstbyinv, degpeople, mean)
plot(as.numeric(names(res)), res)


> best,
> simone
> Il giorno 29/mar/2011, alle ore 20.26, Gábor Csárdi ha scritto:
>> Simone,
>> I am not completely sure what you want to correlate. Can you simply
>> write down, what exactly would be on the two axes in your desired
>> plot?
>> Also, it helps, if you send some toy data or graph, or code that
>> creates toy data. Otherwise people might be reluctant to spend ten
>> minutes on making up some data. At least I am.
>> Best,
>> Gabor
>> On Tue, Mar 29, 2011 at 6:19 AM, Simone Gabbriellini
>> <address@hidden> wrote:
>>> Hello List,
>>> I would like to plot a correlation between a degree distribution of nodes 
>>> versus one of their attribute. The situation is as follow:
>>> - users (type==0) have the attribute $invitedby
>>> - project (type==1) have the attribute $startedby
>>> I want to know if there is a correlation between the degree of users and 
>>> the participation in project where users$invitedby == project$startedby.
>>> If the plot results in a straight line near the bisector, I know that users 
>>> are used to join only project made by the users that also invited them.
>>> I have this for degree distribution:
>>> deg<-degree(g, V(g)[type==0])
>>> d<-table(deg)
>>> dd<-as.numeric(d)/sum(as.numeric(d))
>>> deglist<-as.numeric(names(d))
>>> now I need to see for each node A with degree in deglist the average number 
>>> of project P linked to A where A$invitedby==P$startedby
>>> but I really lose myself here...
>>> any help more than welcome.
>>> best,
>>> Simone
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>> --
>> Gabor Csardi <address@hidden>     MTA KFKI RMKI

Gabor Csardi <address@hidden>     MTA KFKI RMKI

reply via email to

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