igraph包使用节点之间的最短路径计算中介性. http://igraph.sourceforge.net/doc/R/betweenness.html
现在我想用随机游走计算中介性.
基于随机游走的中介中心性度量,MEJ Newman,Social Networks 27,39-54(2005).
我知道python中的NetworkX可以实现这个功能.但由于我使用的网络很大,它结果是内存错误.
有没有关于如何使用随机游走计算中间性的建议?
谢谢!
我想使用PostGIS创建一个多边形表.表'point'中的每一行都有三个点ID.表'point_location'具有点的位置信息.我用Google搜索了这个问题,但未找到答案.以下代码有什么问题?
SELECT ST_GeomFromText('POLYGON((' || b.x || ' ' || b.y || ',' || c.x || ' ' || c.y || ',' || d.x || ' ' || d.y || ',' || b.x || ' ' || b.y'))',4326)
AS polygon
FROM point a, point_location b, point_location c, point_location d
WHERE a.p1=b.point_id AND a.p2=c.point_id AND a.p3=d.point_id
Run Code Online (Sandbox Code Playgroud) 有没有办法在OpenStreetMap中下载关于中国的eh县界的shp格式文件?
library(igraph)
g=graph.famous("Zachary")
c=walktrap.community(g)
a=community.to.membership(g,c$merges,steps=2)
b=a$membership
modularity(g,b)
Run Code Online (Sandbox Code Playgroud)
运行该modularity(g,b)功能时,R没有响应.为什么?
在文档中,http: //igraph.sourceforge.net/doc/R/read.graph.html
NCOL格式
大图形布局程序(http://bioinformatics.icmb.utexas.edu/lgl)使用此格式,它只是一个符号加权边列表.它是一个简单的文本文件,每行一个边.边由两个由空格分隔的符号顶点名称定义.(符号顶点名称本身不能包含空格.)它们后跟一个可选数字,这将是边缘的权重; 数字可以是负数,也可以是科学记数法.如果没有为边缘指定权重,则假定为零.
生成的图形始终是无向的.LGL不能处理包含多个或循环边的文件,但是这里没有检查,因为igraph对这些很满意.
句子是什么(结果图总是无向的.)是什么意思?
我使用ncol格式读取数据.
g<-read.graph("file.ncol",format="ncol",directed=TRUE)
is.directed(g)
TRUE
Run Code Online (Sandbox Code Playgroud)
结果为TRUE.所以我认为这个图是有针对性的.但是为什么文件说结果图总是无方向的?
当我们使用'中性'函数介于中间(g,weights = NULL,directed = FALSE)时,如果图形具有权重属性,即使我们写权重= NULL,该函数仍将使用权重属性计算中介性.但我想计算没有权重属性的中介.所以我觉得这个功能看起来很奇怪.为什么在写weight = NULL时它仍然使用weight属性?
function (graph, v = V(graph), directed = TRUE, weights = NULL,
nobigint = TRUE, normalized = FALSE)
{
if (!is.igraph(graph)) {
stop("Not a graph object")
}
v <- as.igraph.vs(graph, v)
if (is.null(weights) && "weight" %in% list.edge.attributes(graph)) {
weights <- E(graph)$weight
}
if (!is.null(weights) && any(!is.na(weights))) {
weights <- as.numeric(weights)
}
else {
weights <- NULL
}
on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
res <- .Call("R_igraph_betweenness", graph, v - 1, as.logical(directed),
weights, as.logical(nobigint), PACKAGE = …Run Code Online (Sandbox Code Playgroud) 我有一张表,其中有一列具有无序值。我想按降序排列此列并添加一列来记录其顺序。我的SQL代码是:
select *
into newtable
from oldtable
order by column_name desc;
alter table newtable add column id serial;
Run Code Online (Sandbox Code Playgroud)
这能实现我的目标吗?我知道 PostgreSQL 中的行没有固定的顺序。所以我对此不太确定。
我对 igraph 包做了一个小改动,想安装这个改动过的包。但是我之前已经在电脑中安装了 raw igraph 包。这两个包具有相同的名称。
我试图将描述文件中的名称从igraph更改为igraphmy。但它没有用。如错误所示:
Error : .onLoad failed in loadNamespace() for 'igraphmy', details:
call: library.dynam("igraph", pkgname, libname, local = FALSE)
error: DLL 'igraph' not found: maybe not installed for this architecture?
Run Code Online (Sandbox Code Playgroud)