Hi everyone! I have a problem in computing the shortest paths in a network in R. In particular, I have randomized a two-mode network with the following code:
library(tnet)
n1 <- 441
n2 <- 210
ptie <- nrow(data_network)/(n1*n2)
random_data <- rg_tm(ni=n1, np=n2,ties=ptie, seed = 1000)
random_network = network(random_data,matrix.type="edgelist",directed = TRUE)
But then when I try to compute the shortest paths with the following code:
distance_tm(random_network, projection.method="sum")
I have the following error:
Error in if (ncol(net) == 3) { : the argument has lenght zero
Does anyone know why? The same happens with the following real two-mode network:
structure(list(owner = c("ABBA JEANS MINING Sprl", "ABBA JEANS MINING Sprl", "ACACIA Sprl", "ACACIA Sprl", "ACACIA Sprl", "ACACIA Sprl", "AFRICAN ENGINEERING CORPORATE Sprl", "AFRICAN ENGINEERING CORPORATE Sprl", "AFRICAN ENGINEERING CORPORATE Sprl", "AFRICAN MINERALS (Barbados) Ltd Sprl"), armed_band = c("Mayi Mayi Militia (Bakata Katanga)", "Militia (Elements)", "Batwa Ethnic Militia", "FDD", "Militia (Kamwina Nsapu)", "RCD-Goma", "Anti-Balaka", "Kuluna Communal Militia", "Militia (Kamwina Nsapu)", "Mayi Mayi Militia (Bakata Katanga)"), freq = c(1, 1, 1, 1, 4, 1, 1, 1, 1, 1)), row.names = c(NA, -10L), class = c("tbl_df", "tbl", "data.frame"))
And the same error appears also when I try to compute something different such as:
clustering_tm(random_network)
Thank you very much for your attention!