diff --git a/util-networks.R b/util-networks.R index 1edbb4ab..c6d81305 100644 --- a/util-networks.R +++ b/util-networks.R @@ -1282,6 +1282,14 @@ NetworkBuilder = R6::R6Class("NetworkBuilder", ## combine the networks: ## 1) merge the existing networks u = igraph::disjoint_union(authors.net, artifacts.net) + for (attr in igraph::edge_attr_names(u)) { + values = igraph::edge_attr(u, attr) + NULLs = sapply(values, is.null) + if (any(NULLs)) { + values[NULLs] = NA + u = igraph::set_edge_attr(u, attr, value = values) + } + } ## As there is a bug in 'igraph::disjoint_union' in igraph from its version 1.4.0 on, which is still ## present, at least, until its version 2.0.3 (see https://github.com/igraph/rigraph/issues/761), we need @@ -1806,6 +1814,15 @@ add.edges.for.bipartite.relation = function(net, bipartite.relations, network.co ## add the vertex sequences as edges to the network net = igraph::add_edges(net, unlist(vertex.sequence.for.edges), attr = extra.edge.attributes) + + for (attr in igraph::edge_attr_names(net)) { + values = igraph::edge_attr(net, attr) + NULLs = sapply(values, is.null) + if (any(NULLs)) { + values[NULLs] = NA + net = igraph::set_edge_attr(net, attr, value = values) + } + } } return(net)