I have a data.frame
which describes a bipartite graph with a very large (millions) and a reasonably small (hundreds) independent sets.
I want to get the bipartite projection of the graph on the smaller independent set, but without first creating the large bipartite graph and especially the huge bipartite projection to the larger independent set. The reason for this limitation is an igraph
segfault and a RAM limitation (I have only 8GB RAM).
E.g., given
data.frame(beg=c("a","a","b","b","c","c"),
end=c("1","2","1","2","1","2"),
weight=1:6)
I want data frame
data.frame(beg=c("a","a","b"),
end=c("b","c","c"),
weight=c(1+3+2+4,1+5+2+6,3+5+4+6))
where weights of edges add up.
(in this example, abc
is the "smaller" set and 12
is the "larger" one).