Setting type of the nodes in a bipartite weighted graph

I have a dataset of three colums called "rede" being rede$PORT rede$COUNTRY and rede$WEIGHT the columms of the dataset I try to create a bipartite graph with the two firs colums as vertex and the thirth colum as the Weight of the edge between them. So I execute

g <- graph_from_data_frame(rede)
E(g)$weight <- rede$WEIGHT
Acording to the bipartite documentation, if the graph is bipartite, g$type should be TRUE for nodes in rede$PORT AND false for nodes in rede$COUNTRY, but intially g$type is NULL To try to sove it, i set all the $type nodes to TTRUE

V(g)$type <- FALSE
Now the graph is bipartite, but all the nodes belong to group 2.

To set the group 1 nodes to False I tried

V(g)$type <- V(g)$name %in% rede[,2]
I try to set V(g)$type to TRUE fot those nodes belonging to cathegory COUNTRY: second Column of the dataset, but It's not working, and of course if I plot the graph as bipartite: plot(g, vertex.label=NA, vertex.size=7, layout=layout.bipartite) I get a Flat plot Any help about how to set V(g)$type to True if the name of the Node is in rede[,2] and then get a true bipartite graph will be more than welcome

Just in case someone need it.. I come across the answer...
V(g)$type <- bipartite_mapping(g)$type

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.