Bipartite graph Error, I Graph, R
1
0
Entering edit mode
4.7 years ago
Pluto ▴ 10

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)
R I graph Network programming • 1.4k views
ADD COMMENT
1
Entering edit mode
4.7 years ago
ATpoint 82k

Runs without error on my machine.

ADD COMMENT
0
Entering edit mode

I do not understand the Error

ADD REPLY
1
Entering edit mode

I cannot reproduce it. I suggest you update igraph to the most recent version, restart the entire R session and try to rerun everything. Maybe something strange straying in your environment, I do not know.

ADD REPLY
1
Entering edit mode

Neither any error, here:

fff

Please restart your R session for each new analysis. If that still does not work, then paste (here) the output of sessionInfo()

ADD REPLY
1
Entering edit mode

I tried all of that without output then tried R cloud and it was Ok Anyway thanks a lot

ADD REPLY

Login before adding your answer.

Traffic: 1093 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6