I do not understand the Error
Bipartite graph Error, I Graph, R
Hey, I used I Graph to creat a bipartite graph but I have an error
Error in UseMethod("$") : no applicable method for '$' applied to an object of class "igraph.vs"
the following is simple example to my code Suggestions ? Thnx
library(igraph)
# My matrix containing PPI
m = matrix(data = sample(0:1, 16, replace = TRUE), nrow = 4, ncol = 4)
colnames(m) = c("LRRK2","LRRK2", "BAG5", "BAG5")
rownames(m) = c("BAG5", "HSPA8", "HSPA8", "GAK")
# Convert it to a bipartitie network
bg = igraph::graph.incidence(m)
# See the vertex attributes
V(bg)$type
V(bg)$name
# Plot the network
shape = ifelse(V(bg)$type, "circle", "square") # assign shape by node type
col = ifelse(V(bg)$type, "red", "yellow") # assign color by node type
plot(bg, vertex.shape = shape, vertex.color = col)
• 2,095 views
•
link
1 answer
Log in to answer this question.
