Title: read bipartite graphs and one mode projection
Tags: r;igraph
Question: How can I read a bipartite graph?
I tried the following code, but when I tried to make OMP, it says
Error in bipartite.projection(g, types = NULL) :
Not a bipartite graph, supply `types' argument
here is the code :
edgelist = read.csv("g1.csv",header=FALSE,sep=",")
g  = graph.edgelist(as.matrix(edgelist),directed=FALSE)
proj <- bipartite.projection(g,types=NULL)
g2= proj[[1]]
myplot(g2)
g1.csv 1,5 1,4 2,4 3,5
Comment: if `set_vertex_attr` does not quite work, use this: https://rpubs.com/pjmurphy/317838 by Phil Murphy & Brendan Knapp . In case link is down: `V(g)$type <- bipartite_mapping(g)$type  ## Add the "type" attribute to the network.`

Here is the accepted answer: From the docs:
Bipartite graphs have a ‘type’ vertex attribute in igraph, this is
boolean and ‘FALSE’ for the vertices of the first kind and ‘TRUE’
for vertices of the second kind.
So please add a type vertex attribute, that defines which vertices are in which group.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:12/16/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<r><igraph>', 'Title': 'read bipartite graphs and one mode projection', 'ViewCount': 1190, 'id': 20611838, 'user_AboutMe': None, 'user_AccountId': 306855.0, 'user_DisplayName': 'M.M', 'user_Reputation': 1334.0, 'user_Views': 225.0, 'user_id': 617845.0}}