R Igraph подграфа заданный индекс узла и количество узлов для включения в граф

Простое решение с ES5 (перезаписать существующее значение):

function merge(current, update) {
  Object.keys(update).forEach(function(key) {
    // if update[key] exist, and it's not a string or array,
    // we go in one level deeper
    if (current.hasOwnProperty(key) 
        && typeof current[key] === 'object'
        && !(current[key] instanceof Array)) {
      merge(current[key], update[key]);

    // if update[key] doesn't exist in current, or it's a string
    // or array, then assign/overwrite current[key] to update[key]
    } else {
      current[key] = update[key];
    }
  });
  return current;
}

var x = { a: { a: 1 } }
var y = { a: { b: 1 } }

console.log(merge(x, y));

0
задан Dario Federici 28 March 2019 в 05:35
поделиться

1 ответ

Это ответ:

distan <- 3
node <- "node name"

subnetwork <- induced.subgraph(network, vids = as.vector(unlist(neighborhood(network, distan, nodes = node, mode = 'all'))))

plot.igraph(subnetwork, vertex.size=10)
0
ответ дан Dario Federici 28 March 2019 в 05:35
поделиться
Другие вопросы по тегам:

Похожие вопросы: