Skip to content

Commit

Permalink
Fix nodes for networks without edges
Browse files Browse the repository at this point in the history
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 se-sic#150.

Reported-by: Jakob Kronawitter <[email protected]>
Signed-off-by: Thomas Bock <[email protected]>
  • Loading branch information
bockthom authored and fehnkera committed Sep 23, 2020
1 parent bdfe265 commit dbe3d22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util-networks.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit dbe3d22

Please sign in to comment.