I have an edgelist for a two mode network, similar to this:
person Event
Amy football_game
Sam picnic
Bob art_show
I want to perform an analysis on this in R, but seemingly everything I try fails. Converting it to a one mode network runs into memory limitations, and I can't figure out how to analyze it as bipartite in either igraph or tnet.
In igraph, bipartite.projection
gives me all FALSE
, on the igraph object created using
net <- graph.edgelist(myobject)
On tnet, I can't convert the igraph net to a tnet one, and when I try to use the original data frame, it refuses because of duplicates in the graph.
So answers to any of the following would be super appreciated:
- How do I use the
bipartite.mapping
function? - How do I input an igraph object into tnet?
- If all else fails, how I do I input a data frame with duplicate edges into tnet?
Sorry if these are basic questions, but there's very little documentation.
EDIT
Example:
edgelist <- read.table(text="Person Event
Amy football
Bob picnic
Sam artshow",
header=TRUE)
edgelist <- as.matrix(edgelist)
## Igraph Issues
igraph <- graph.edgelist(edgelist)
typevector <- bipartite.projection(igraph)
# gets all FALSE
edgelist2 <- get.edgelist(igraph)
typevector <- bipartite.projection(edgelist2)
# same thing
## tnet issues
tnet <- as.tnet(edgelist)
# gives error: "There are duplicate events in the edgelist"
tnet <- as.tnet(edgelist2)
clusterMat <- clustering_local_tm(tnet)
# gives error: "max not meaningful for factors"
onemode <- projecting_tm(tnet, method="Newman")
# gives error: "arguments must have same length"