I have a data frame as:
library(igraph)
mygraph<-graph(edges=c(2,1,4,1,4,3,5,2,5,4,7,3,7,5,8,4,8,7),n=8)
E(mygraph)$weight<-c(0.98,0.57,0.86,0.57,0.94,0.68,0.76,0.57,0.86)
mygraph<- set_edge_attr(mygraph,”weight”,index=E(mygraph),c(0.98,0.57,0.86,0.57,0.94,0.68,0.76,0.57,0.86))
closenessmygraph<-closeness(mygraph,mode=”in”)
closenessmygraph1<-closeness(mygraph,mode=”out”)
closenessmygraph2<-closeness(mygraph,mode=”all”)
betweennessmygraph<-betweenness(mygraph,normalized=TRUE)
plot(mygraph)
the values for “closenessmygraph” are
(0.1545595 0.2444988 0.2096436 0.3115265 0.4201681 NaN 1.1627907 NaN)
the coding is for analysisng the vulnerability for 8 tanks.how can i fix the NaNs? and change them to a number as like as othes.
زهرا خدابخش is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.