From dbe3d226c1efbd8cf94115db4990e844793aab65 Mon Sep 17 00:00:00 2001 From: Thomas Bock Date: Sun, 16 Dec 2018 20:16:08 +0100 Subject: [PATCH] Fix nodes for networks without edges When a network contains no edges but more than one node, all the nodes get combined. To fix this, the respecting data frame, which contains the nodes, has to be transposed. This fixes #150. Reported-by: Jakob Kronawitter Signed-off-by: Thomas Bock --- util-networks.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util-networks.R b/util-networks.R index f25a6dc8..6d38e4f7 100644 --- a/util-networks.R +++ b/util-networks.R @@ -1069,7 +1069,7 @@ construct.network.from.edge.list = function(vertices, edge.list, network.conf, d ## if we have nodes to create, but no edges if (is.null(edge.list) || nrow(edge.list) == 0) { ## create network with only the vertices - net = igraph::graph.empty(n = 0, directed = directed) + igraph::vertices(nodes.processed) + net = igraph::graph.empty(n = 0, directed = directed) + igraph::vertices(t(nodes.processed)) } ## if we have nodes and edges else {