从邻接矩阵不生成边
Generating no edges from adjacency matrix
从 igraph
调用 graph_from_adjacency_matrix()
时,我完全没有优势。
library(igraph)
set.seed(42)
# data = read.table("sequences_distancematrix.out", row.names = 1, stringsAsFactors = FALSE, header = TRUE)
data = read.table("https://pastebin.com/raw/UWt56tfh", row.names = 1, stringsAsFactors = FALSE, header = TRUE)
dismat = data.matrix(data)
# build the graph object
network <- graph_from_adjacency_matrix(dismat, mode = "undirected")
但是在检查网络时没有边:
> print_all (network)
IGRAPH f4f6666 UN-- 46 0 --
+ attr: name (v/c)
我虽然这可能是因为 igraph
不接受低于 0 的双数,所以 x10
矩阵中的所有内容但结果相同
距离矩阵:https://pastebin.com/UWt56tfh
如有任何帮助,我们将不胜感激。
- 如果你想要加权边:
(network <- graph_from_adjacency_matrix(dismat, mode = "undirected", weighted = TRUE))
- 如果你想有未加权的边缘:
(network <- graph_from_adjacency_matrix(dismat > 0, mode = "undirected"))
我不确定您是如何尝试将所有内容乘以 10,但这对我有用。
library(igraph)
data <- read.table("https://pastebin.com/raw/UWt56tfh",
row.names = 1, stringsAsFactors = FALSE, header = TRUE)
dismat <- data.matrix(data)
network <- graph_from_adjacency_matrix(dismat*10, mode = "undirected")
print_all(network)
从 igraph
调用 graph_from_adjacency_matrix()
时,我完全没有优势。
library(igraph)
set.seed(42)
# data = read.table("sequences_distancematrix.out", row.names = 1, stringsAsFactors = FALSE, header = TRUE)
data = read.table("https://pastebin.com/raw/UWt56tfh", row.names = 1, stringsAsFactors = FALSE, header = TRUE)
dismat = data.matrix(data)
# build the graph object
network <- graph_from_adjacency_matrix(dismat, mode = "undirected")
但是在检查网络时没有边:
> print_all (network)
IGRAPH f4f6666 UN-- 46 0 --
+ attr: name (v/c)
我虽然这可能是因为 igraph
不接受低于 0 的双数,所以 x10
矩阵中的所有内容但结果相同
距离矩阵:https://pastebin.com/UWt56tfh
如有任何帮助,我们将不胜感激。
- 如果你想要加权边:
(network <- graph_from_adjacency_matrix(dismat, mode = "undirected", weighted = TRUE))
- 如果你想有未加权的边缘:
(network <- graph_from_adjacency_matrix(dismat > 0, mode = "undirected"))
我不确定您是如何尝试将所有内容乘以 10,但这对我有用。
library(igraph)
data <- read.table("https://pastebin.com/raw/UWt56tfh",
row.names = 1, stringsAsFactors = FALSE, header = TRUE)
dismat <- data.matrix(data)
network <- graph_from_adjacency_matrix(dismat*10, mode = "undirected")
print_all(network)