igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] claculate closeness method in iGraph to disconnected graphs


From: Saeed Rahmani
Subject: [igraph] claculate closeness method in iGraph to disconnected graphs
Date: Tue, 16 Jun 2015 09:21:10 +0000 (UTC)

I use igraph in R for calculate graph measure, my graph make in a PIN that not Connected Graph and is Disconnected Graph. closeness method for connected graph is good and right calculate, and for Disconnected graph in not Good!
library(igraph)
# Create of Graph Matrix for Test Closeness Centrality
g <- read.table(text="A B 
  1 2
  3 4
  3 5", header=TRUE)
gadj <- get.adjacency(graph.edgelist(as.matrix(g), directed=FALSE))
igObject <- graph.adjacency(gadj) # convert adjacency matrix to igraph object
gCloseness <- closeness(igObject,weights = NULL) # Assign Closeness to Variable for print

[1] 0.06250000 0.06250000 0.08333333 0.07692308 0.07692308
 This output is Right ? and if right How to Calculate ?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]