Hi, The code and the calculation is correct; the density can be larger than 1 if the graph can have multiple edges between two vertices. In this case, the density has no upper bound.
T. > On 2017. Jun 7., at 0:25, Stefan Wallaschek <[email protected]> > wrote: > > Hi, > > thank you Tamas for your response. The bipartite graph that I am using is not > directed. > If I understand your answer correctly on how to calculate density, then, the > code above might be wrong, because it says > # Number of top and bottom nodes > top<-length(V(g)[type==FALSE]) > bottom<-length(V(g)[type==TRUE]) > # Number of edges > m<-ecount(g) > # Mean degree for top and bottom nodes > ktop<-m/top > kbottom<-m/bottom > # Density for bipartite network > bidens<-m/(top*bottom) > So, it takes the actual existing number of edges in the bipartite graph and > divides it by the product of the number of nodes for each type. Based on your > described ratio, it seems to miss the total number of possible edges between > the top and bottom vertices, right? > In my case and as an example, we have 11 "top" vertices and 17 "bottom" > vertices and the number of edges (m) is 215 (because in this graph, there can > be multipe edges between a top and a bottom vertice). If I take the numbers > and calculate the density in the following way 215/(11*17), I get 1.15. > > So, is there anything missing in the calculation or could the multiple edges > in the network be the problem here? And how could it be solved? > > Best wishes, > Stefan > > > > > >> Am 06.06.2017 um 20:34 schrieb Tamas Nepusz: >>> The suggested code works out and I also checked the named reference for >>> further information, but I couldn't find anything about the ratio of >>> bipartite network density. It either doesn't seem to be the 0-1 ratio of >>> one-mode networks or I did something wrong, because I get results about >>> 1.0 for the 2-mode-networks? >> You are probably doing something wrong because the measure should be between >> 0 and 1. It is actually simply the ratio of the total number of edges and >> the total number of _possible_ edges between the "top" and the "bottom" >> vertices. If you get a result close to 1.0, it means that almost all of the >> possible edges between the top and the bottom vertices are present -- >> assuming that there are no edges between top-top or bottom-bottom, which >> should be the case anyway if it is a bipartite network. >> >> One possible catch is if your network is directed; in that case, you should >> multiply the denominator of the fraction (i.e. the number of possible edges) >> by 2. >> >> T. >> >> >> _______________________________________________ >> igraph-help mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/igraph-help > > -- > Stefan Wallaschek > Visting PhD fellow at School of Politics and International Relations (SPIRe) > University College Dublin > -- > [email protected] > PhD Fellow > Bremen International Graduate School of Social Sciences (BIGSSS)/ > University of Bremen > Mary-Somerville-Straße 9 > P.O. Box 33 04 40 > 28359 Bremen (Germany) > https://www.bigsss-bremen.de/people/phd-fellows/stefan-wallaschek > Twitter: https://twitter.com/s_wallaschek > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
