计算网络周期 [英] count cycles in network

查看:75
本文介绍了计算网络周期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最好的方法是什么,或者有没有实现的方法可以对网络中的3个和4个周期进行计数.

What is the best way, or are there any ways implemented in are to count both 3 and 4 cycles in networks.

3个周期等于要从一个模式网络计算的三个节点(三角形)的连接组从两个模式网络中计算出四个周期相等的四个节点的连接组(正方形)

3 cycles equal connected groups of three nodes(triangles) to be calculated from one mode networks 4 cycles equal connected groups of four nodes(squares) to be calculated from two mode networks

如果我有这样的网络:

onemode <- read.table(text= "start end
                              1    2
                              1    3
                              4    5
                              4    6
                              5    6",header=TRUE)

twomode <- read.table(text= "typa typev
                              aa    a
                              bb    b
                              bb    a
                              aa    b",header=TRUE)

我以为

 library(igraph)
 g <- graph.data.frame(twomode)
 E(g)
 graph.motifs(g, size = 4) 

将计算我的两种模式网络中的平方数,但我不理解输出.我以为结果是1

would count the number of squares in my two mode network but I dont understand the output. I thought the result would be 1

推荐答案

?graph.motifs

graph.motifs在图形中搜索给定大小的图案,并返回包含不同主题个数的数字向量.的顺序图案由其同构类定义,请参见graph.isoclass.

graph.motifs searches a graph for motifs of a given size and returns a numeric vector containing the number of different motifs. The order of the motifs is defined by their isomorphism class, see graph.isoclass.

所以它的输出是数字矢量,其中每个值都是图形中某个主题(大小为4或3)的计数.

So the output of this is numeric vector where each value is the count of a certain motif(with sizes is 4 or 3) in your graph.

 graph.motifs(g,size=4)

要获取图案总数,可以使用 graph.motifs.no

To get the total number of the motifs, you can use graph.motifs.no

graph.motifs.no(g,size=4)
[1] 1

哪个是图案编号20

which(graph.motifs(g,size=4) >0)
[1] 20

这篇关于计算网络周期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆