igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Generate bipartite graph with specified degree distribution


From: Gábor Csárdi
Subject: Re: [igraph] Generate bipartite graph with specified degree distribution [Again]
Date: Mon, 20 May 2013 10:35:38 -0400

On Mon, May 20, 2013 at 10:15 AM, Caio Santos <address@hidden> wrote:
[...]
But I haven't resolved the problem yet because is required that the sum out-degree and in-degree be the same even number.
Please, take a look at my example:

users = 1000
items = 500

usersDegs = sample(1:items, size=items, replace=TRUE, prob=(1:items)^-2)
itemsDegs = sample(1:users, size=users, replace=TRUE, prob=(1:users)^-2)
g <- degree.sequence.game(out.deg = c(usersDegs, rep(0, items)), in.deg = c(rep(0, users), itemsDegs))

It's very unlikely have that required sum using sample from a specified distribuition.

Well, if the sums of the degrees for the users and items do not match, then it is impossible to create a bipartite graph from them, right? Imagine a small example where you have 
userDegs=c(1,1,1)
itemDegs=c(1,1)
Can you create such a bipartite graph? No, you can't. So I am actually not sure what exactly you are trying to achieve here. What should degree.sequence.game() do in this case?

Is there a way to use degree.sequence.game with sampling from a distribution?

Sure, that's how people used very often, I guess. But your degree sequences have to satisfy some criteria. You have to sample them that way, or postprocess them. E.g. you could "scale" them in your example, just keep in mind that they have to be integers.

Is there another function to achieve this?

I think you should think about what "this" is, i.e. what exactly you want to do.

Gabor

reply via email to

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