简体   繁体   English

在igraph中构造完整的子图

[英]constructing complete subgraph in igraph

I'm pretty new to R. I wanna know that given a list of node ID's of a graph is there any fast way to connect all the edges between that vertices and create a clique in that graph? 我对R还是很陌生。我想知道,给定一个图的节点ID的列表,有没有一种快速的方法来连接这些顶点之间的所有边并在该图中创建集团?

ps: I'm looking for a really fast method because I'm working on a very large graph. ps:我正在寻找一种非常快速的方法,因为我正在处理非常大的图形。

Thanks in advance. 提前致谢。

Given a vector of vertices idx , we may use combn to create a vector of edges to be added: 给定顶点向量idx ,我们可以使用combn创建要添加的边向量:

g1 <- erdos.renyi.game(20, 1 / 20)
idx <- 3:8
g2 <- g1 + edges(c(combn(idx, 2)))
maximal.cliques(g2)
# ...
# [[14]]
# + 6/20 vertices, from 137d7ad:
# [1] 6 3 8 7 5 4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM