Meaning of "Non-bipartite edge found in bipartite projection" error

Any suggestions on what this error means or how to find which value is invalid?

Error in igraph::bipartite.projection(bg, which = FALSE) :
At core/misc/bipartite.c:209 : Non-bipartite edge found in bipartite projection, Invalid value

Please do not post unrelated responses to existing topics. Create a new topic with a meaningful title, and make sure you are doing it within an appropriate category.

The error means that there is at least one edge between vertices of the same partition. The partitions are defined by the type boolean vertex attribute: vertices within the first partition are marked with FALSE, those within the second with TRUE.

Sorry, I couldn’t figure out how to post properly. I did look at “How to Post”, but it didn’t explain how to post. Could that link be wrong?

Is a partition the same as a mode? I have 2 modes (patients and hospitals), the patients in one column and hospitals in another. The ids for these are very different, so there is no way a hospital could be connected to a hospital or a patient to a patient. Although, that is my goal (to switch the 2 modes to one mode) using patients as connections between hospitals with number of patients as the weight.

Is there a way to figure out which value is invalid?

Yes.

But that is precisely what is happening. Maybe the mistake is in marking nodes as hospital or patient.

Take all vertices from one of the partitions and create an induced subgraph for them. Something along the lines of induced_subgraph(g, V(g)[V(g)$type]). This graph should have no edges.

Thank you for your help. I removed dropped some data and now the following code is working.

bipartite_list <- data.frame(read.csv(file.choose()))
head(bipartite_list)
net <-graph.data.frame(bipartite_list, directed=F)
net
head(net)
bipartite.mapping(net)
V(net)$type <- bipartite_mapping(net)$type
size<- bipartite.projection.size(net)
size
head(size)
onemode <- project_table(bipartite_list, joining_col = "pat_id")
g_onemode <-graph.data.frame(onemode, directed=F)

I dropped some rows with low weight using this
few_edge <-delete.edges(g_onemode, which(E(g_onemode)$weight<1000))
but, when I try to graph this the weight is gone and I want edge width based on weight. How can I get weight back into this object?

Can you show a complete minimal example? See here for guidance: How to create a Minimal, Reproducible Example - Help Center - Stack Overflow