0

I don't know anything about R language(syntax)

How can I delete all edges with weight=0 from the graph? For example all edges with 0 similarity 1

Saveen
  • 4,120
  • 14
  • 38
  • 41
Saeed VA
  • 27
  • 4
  • Welcome to SO. It's best practice to provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/28481250#28481250). In addition, it's not clear what exactly you're looking for: _weight_ is commonly associated with edge weights. However, `similarity` compares vertices. – lukeA May 24 '18 at 00:06
  • Please read: https://stackoverflow.com/help/how-to-ask – PixelEinstein May 24 '18 at 00:07

1 Answers1

0

Here's an example on how to delete edges between vertices with zero jaccard similarity:

library(igraph)
g <- make_ring(5) + edges(4,1,2,2)  
par(mfrow = c(1,2))
plot(g)
(s <- similarity(g, method = "jaccard"))
idx <- which(s == 0, arr.ind = T)
g2 <- g - edges(as.vector(t(idx)))
plot(g2)
lukeA
  • 53,097
  • 5
  • 97
  • 100
  • thank you. I am looking for that convert a unique connected graph to a jungle (by delete all edges with weight=0) then compute "edge.betweenness.community()" for each component Simultaneously(parallel computing) is it possible by R? – Saeed VA May 24 '18 at 20:33
  • @SaeedVA You should prly provide an example in the veins I did. "unique connected graph", "jungle", ... many open questions. just follow the links in the comments and put together example code in a new question, which can be run by anyone – lukeA May 24 '18 at 22:03