'Betweenness' 関数 betweenness(g,weights=NULL,directed = FALSE) を使用する場合、グラフに weight 属性がある場合、weights=NULL と記述しても、関数は weight 属性を使用して中間性を計算します。しかし、重み属性なしで中間性を計算したいのです。だから、この機能はおかしいと思います。weights=NULL を記述したときに、まだ weight 属性を使用するのはなぜですか?
function (graph, v = V(graph), directed = TRUE, weights = NULL,
nobigint = TRUE, normalized = FALSE)
{
if (!is.igraph(graph)) {
stop("Not a graph object")
}
v <- as.igraph.vs(graph, v)
if (is.null(weights) && "weight" %in% list.edge.attributes(graph)) {
weights <- E(graph)$weight
}
if (!is.null(weights) && any(!is.na(weights))) {
weights <- as.numeric(weights)
}
else {
weights <- NULL
}
on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
res <- .Call("R_igraph_betweenness", graph, v - 1, as.logical(directed),
weights, as.logical(nobigint), PACKAGE = "igraph")
if (normalized) {
vc <- vcount(graph)
res <- 2 * res/(vc * vc - 3 * vc + 2)
}
if (getIgraphOpt("add.vertex.names") && is.named(graph)) {
names(res) <- V(graph)$name[v]
}
res
}