- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 igraph
?modularity
部分给出了示例代码
g <- graph.full(5) %du% graph.full(5) %du% graph.full(5)
g <- add.edges(g, c(1,6, 1,11, 6, 11))
wtc <- walktrap.community(g)
modularity(wtc)
#[1] 0.5757575
modularity(g, membership(wtc))
#[1] 0.5757576
wtc
的输出显示:
wtc
#Graph community structure calculated with the walktrap algorithm
#Number of communities (best split): 3
#Modularity (best split): 0.5757575
#Membership vector:
# [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2
我对不同的部分感到困惑:
modularity(wtc)
# and
modularity(g, membership(wtc))
wtc
本身已经有了最好的拆分及其相关的模块化。为什么要在 wtc
上调用 modularity
? modularity(g, membership(wtc))
我看到的是找到特定预选拆分的模块化,这对我来说更有意义(在这种情况下是最佳拆分)。
在什么情况下您会认为这些结果会有所不同,为什么会这样,例如
g2 <- structure(list(from = structure(c(2L, 3L, 4L, 1L, 3L, 4L, 1L,
2L, 4L, 1L, 2L, 3L), .Label = c("A", "B", "C", "D"), class = "factor"),
to = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L,
4L, 4L), .Label = c("A", "B", "C", "D"), class = "factor"),
weight = c(2L, 0L, 0L, 2L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L
)), .Names = c("from", "to", "weight"), row.names = c(2L,
3L, 4L, 5L, 7L, 8L, 9L, 10L, 12L, 13L, 14L, 15L), class = "data.frame")
g2 <- graph.data.frame(g2, vertices = unique(g2[1]))
set.seed(444)
wtc2 <- walktrap.community(g2)
modularity(wtc2)
# [1] 0.4444444
wtc2
# Graph community structure calculated with the walktrap algorithm
# Number of communities (best split): 2
# Modularity (best split): 0.4444444
# Membership vector:
# B C D A
# 2 1 1 2
modularity(g2, membership(wtc2))
# [1] -0.1666667
sessionInfo()
# R version 3.0.2 (2013-09-25)
# Platform: x86_64-apple-darwin10.8.0 (64-bit)
#
# locale:
# [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
# other attached packages:
# [1] Matrix_1.0-14 lattice_0.20-23 igraph_0.6.6 reshape2_1.2.2 ggplot2_0.9.3.1
#
# loaded via a namespace (and not attached):
# [1] colorspace_1.2-4 dichromat_2.0-0 digest_0.6.3 grid_3.0.2 gtable_0.1.2 labeling_0.2
# [7] MASS_7.3-29 munsell_0.4.2 plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5 scales_0.2.3
# [13] stringr_0.6.2 tools_3.0.2
最佳答案
modularity(graph, split)
在您的 igraph 版本中不支持边权重,因此存在差异。在这种情况下,基本上假定所有边的权重都为 1。
关于r - `modularity()`的正确使用和解释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20313608/
我具有以下Xcode项目依赖项: A -> C B -> C 当我分别构建它们时,一切正常。 但是,我想将A和B添加到同一Xcode项目中,从而创建以下依赖关系图: / -> A -> C D
“模块化”的有效性取决于将系统划分为模块时使用的标准。 我想要的是,提出一些可用于将系统分解为模块的标准。 最佳答案 Cohesion : 模块中的功能是相关的。 Low coupling :模块之间
加载+重新加载 fsx 文件的推荐方法是什么?只是试验......是的,是的,正确的语言,正确的工作等等。 我喜欢如何在 FSI 中完成以下工作: #load "script.fsx"; open S
在 igraph ?modularity 部分给出了示例代码 g <- graph.full(5) %du% graph.full(5) %du% graph.full(5) g <- add.edg
最近我对如何组织我的 Scala 代码感到困惑,因为有很多选择。 Scala 如何/何时使用包、对象、包对象来组织代码是否有任何指导方针? 最佳答案 了解 Scala 的功能 首先,我们需要了解每种模
我的 node.js 应用程序中有这样的文件结构: 应用程序 模特 用户 书 Controller 用户 书 观看次数 用户 书 我想让我的应用模块化。如何从 user Controller 与 bo
因为我需要测试 Boost 的一些实验性功能,所以我想从 Modular Boost 存储库安装 Boost。 我按照 https://svn.boost.org/trac/boost/wiki/Tr
我用了flutter_modular用于 flutter web 导航。 import 'package:flutter_modular/flutter_modular.dart'; class A
我需要计算 (a/b) mod m 哪里 a 和 b 是非常大的数字。 我想做的是计算 (a mod m) * (x mod m) ,其中 x 是 modular inverse的 b . 我尝试使用
我想构建一个可以在单个页面上有多个实例的 jQuery 应用程序。 但是,我遇到了一个实例从其他实例接收事件的问题。例如,如果我有以下事件: $('#start_btn').click(...) 如果
我是 java 和 javafx 2 的新手。我想要做的是一个应用程序,它基本上是一个容器,用于放置以后可以添加的单独“模块”。 主要应用程序应该是某种内容浏览器,用于扫描文件夹中的模块。然后,您可以
我一直在考虑创建一个程序,该程序可以执行多个不同的任务,同时由一个中央线程监视。这个想法是创建一个核心程序,该程序将在运行时/运行时查找并加载单独的模块。这些模块将在将完成的对象传递给另一个模块之前执
目前正在创建一个代码,使用两种类型的优先级队列作为单独的方法,方法之间的代码相似,试图将它们模块化为一个方法,但优先级队列类型的参数不同 我当前正在运行 eclipse,尝试添加 if 语句(如果 1
今天我无法将 apply 函数应用到 modularity 函数,后者的函数在 'igraph' 包中。以下是代码和结果" > library(igraph) > g = graph.full(2)
目标:创建一个模块化应用程序,其上的插件必须具有 UI(这是关键点)。我有关于主应用程序(“服务器”)的所有信息,也有关于所有插件的信息(所有这些都将由我们制作)。所以我们想把主 apk 给用户,让他
我无法为 body1TextProvider 和 body2TextProvider 设置白色文本颜色。只有灰色可供选择。 我的代码: let modularLarge = CLKComplicati
我想使用 Rails 构建一个可扩展的模块化应用程序,该应用程序可以配置以满足个人需求。 让我解释一下我对“可扩展”和“模块化”的理解。例如,假设我正在开发一个博客应用程序引擎并且我有一个名为 Blo
我是一名在大学工程项目团队工作的学生。 我们的软件子团队正在寻求创建一个模块化的 GUI,允许通过捕捉面板进行实时重新配置,用户可以在 GUI 周围移动和分离(具有此类 GUI 的流行程序:Adobe
如果我用 emcc 编译我的 C++ 代码没有 -s MODULARIZE=1 -s 'EXPORT_NAME="createMyModule"' ,我可以加载我的 WebAssembly 并访问 F
基于此结构:http://flask.pocoo.org/docs/patterns/packages/ 我也尝试过这篇文章:Deploying Flask app to Heroku 我无法让它在
我是一名优秀的程序员,十分优秀!