对 R igraph 对象中的派系进行采样
我想从 igraph 对象中随机采样一个派(不一定是最大的)。
一种方法是:
library(igraph)
G <- erdos.renyi.game(10, .25) #a small graph
cliques <- cliques(G, min=2) #list all cliques
sample(cliques,1) #sample one clique
这对于小图来说效果很好,但是对于大图或密集图来说,完整的派系枚举是不切实际的。
另一种方法可能涉及对节点进行采样(随机或与度数成比例),枚举其邻域中的派系,然后从该列表中采样。但是,我不认为这会从所有派系中随机抽样。
任何建议将不胜感激!
I would like to randomly sample a clique (not necessarily maximal) from an igraph object.
One approach would be:
library(igraph)
G <- erdos.renyi.game(10, .25) #a small graph
cliques <- cliques(G, min=2) #list all cliques
sample(cliques,1) #sample one clique
This works fine for small graphs, but a complete enumeration of cliques is impractical for large or dense graphs.
An alternative might involve sampling a node (randomly or proportional to degree), enumerating the cliques in its neighborhood, then sampling from that list. But, I don't think this would randomly sample from all cliques.
Any suggestions would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论