I have a quick question about retaining node information after converting to a one mode projection.
library(igraph)
data <- data.frame( company=c(letters[1:5],letters[5:8],"a"), Deal=c(14,14,15,15,16,16,17,17,18,18))
g <- graph_from_data_frame(data)
V(g)$type <- V(g)$name %in% data[,1]
proj <- bipartite.projection(g)
proj$proj2
I want to use the company to company ties as my new edgelist but retain the Deal numbers as an edge attribute so that I would ideally have a new dataset that looks like this:
Source Target Deal
a b 14
c d 15
f g 17
h a 18
where "Source", "Target", and "Deal" are each in their own column. (Sorry this does not look prety!)
I can create a dataframe with source and target, but am have a hard time figuring out how to add deal back in the third column. Any advice or guidance would be greatly appreciated! Here is the code I am using:
el00<-as_edgelist(proj$proj2)
colnames(el00) <- c("Source", "Target")