How do I plot a network of type bipartite in R? Similar to this:
I have similar data but with weights for both genes and diseases and SARS. This network is an example. I have different kind of attributes. I followed a link here. But due to my little knowledge in this topic, I could not get much out of it. Thanks in advance for any help.
For the example you provided, I would recommend using the
x
andy
attributes for visualizing a bipartite graph. E.g.:EDIT: added code to give the vertices and edges different colors for clarity.
From the
?bipartite_graph
help:So you could do something like this (
igraph 1.0.1
):Check also
?bipartite
.Using the example provided by the OP in the comments. Since the graph is multipartite and given the provided data format, I would first create a bipartite graph, then add the additional edges. Note that although the resulting graph returns TRUE for
is_bipartite()
the type argument is specified as numeric instead of logical and may not work properly with other bipartite functions.The function
layout.concentric()
is in (my) package rTRM, available from Bioconductor. It is really a simple implementation I wrote to do exactly what you want. I am not completely sure whether the latestigraph
version has the same functionality though (it may be).Or you can use the
multigraph
package.that can produce the binomial projection of the two-mode data set