[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [igraph] graph density on bipartite networks

**From**: |
Gábor Csárdi |

**Subject**: |
Re: [igraph] graph density on bipartite networks |

**Date**: |
Tue, 26 Oct 2010 09:40:58 +0200 |

Hi Simone,
On Mon, Oct 25, 2010 at 9:56 PM, Simone Gabbriellini
<address@hidden> wrote:
>* Hello List,*
>
>* I've found a possible issue in igraph regarding density for bipartite *
>* networks. According to this paper:*
>
>* Borgatti, S. P. and Everett, M. G. (1997). Network Analysis of 2-mode Data. *
>* Social Networks, 19(3):243–269.*
>
>* "the standard denominators are clearly not appropriate for 2-mode data, since *
>* no ties are possible within vertex sets. The maximum number of ties possible *
>* occurs when every vertex in one set is connected to every vertex in the *
>* other. If the vertex sets are of size ni and no then this amounts to ni*no *
>* edges in the undirected case and 2*ni*no in the directed case"*
>
>* What do you think about this? I guess density for bipartite graph should be *
>* calculated according to something like:*
>
>* ecount(g) / length(V(g)[type==FALSE]) * length(V(g)[type==TRUE])*
yes, except that some parens are misssing. I think you want
ecount(g) / (length(V(g)[type==FALSE]) * length(V(g)[type==TRUE]))
Here is a function that works for directed networks as well:
density.bipartite <- function(graph) {
if (is.directed(graph)) {
ecount(graph) / sum(V(graph)$type) / sum(!V(graph)$type) / 2.0
} else {
ecount(graph) / sum(V(graph)$type) / sum(!V(graph)$type)
}
}
Best,
Gabor
>* best,*
>* Simone*
>* _______________________________________________*
>* igraph-help mailing list*
>* address@hidden*
>* http://lists.nongnu.org/mailman/listinfo/igraph-help*
>
--
Gabor Csardi <address@hidden> UNIL DGM