R igraph 手册页

如果您从 R 中使用 igraph,请使用此选项

fit_hrg {igraph}R 文档

拟合分层随机图模型

描述

fit_hrg 将 HRG 拟合到给定的图。它执行指定的 steps 数量的 MCMC 步骤来进行拟合,如果指定的步骤数为零,则使用收敛准则。如果 hrg 参数中给出了一个 HRG,并且 start 参数为 TRUE,则 fit_hrg 可以从给定的 HRG 开始。

用法

fit_hrg(graph, hrg = NULL, start = FALSE, steps = 0)

参数

要拟合模型的图。有向图中边的方向将被忽略。

hrg

分层随机图模型,以 igraphHRG 对象的形式。fit_hrg 允许此值为 NULL,在这种情况下,将使用随机起点进行拟合。

开始

逻辑值,指示是否从提供的 igraphHRG 对象开始拟合/抽样,还是从随机起点开始。

steps

要进行的 MCMC 步骤数。如果此值为零,则将执行 MCMC 过程直到收敛。

fit_hrg 返回一个 igraphHRG 对象。这是一个包含以下成员的列表

向量,包含内部树顶点的左子节点。第一个顶点始终是根顶点,因此向量的第一个元素是根顶点的左子节点。内部顶点用负数表示,从 -1 开始向下,即根顶点为 -1。叶顶点用非负数表示,从零开始向上。

向量,包含顶点的右子节点,编码方式与 left 向量相同。

prob

附加到内部顶点的连接概率,第一个数字属于根顶点(即内部顶点 -1),第二个数字属于内部顶点 -2,依此类推。

给定内部顶点下子树中的边数。

vertices

给定内部顶点下子树中的顶点数,包括自身。

参考

A. Clauset, C. Moore, and M.E.J. Newman. Hierarchical structure and the prediction of missing links in networks. Nature 453, 98–101 (2008);

A. Clauset, C. Moore, and M.E.J. Newman. Structural Inference of Hierarchies in Networks. In E. M. Airoldi et al. (Eds.): ICML 2006 Ws, Lecture Notes in Computer Science 4503, 1–13. Springer-Verlag, Berlin Heidelberg (2007).

参见

其他分层随机图函数:consensus_tree(), hrg-methods, hrg_tree(), hrg(), predict_edges(), print.igraphHRGConsensus(), print.igraphHRG(), sample_hrg()

示例

## We are not running these examples any more, because they
## take a long time (~15 seconds) to run and this is against the CRAN
## repository policy. Copy and paste them by hand to your R prompt if
## you want to run them.

## Not run: 
## A graph with two dense groups
g <- sample_gnp(10, p=1/2) + sample_gnp(10, p=1/2)
hrg <- fit_hrg(g)
hrg

## The consensus tree for it
consensus_tree(g, hrg=hrg, start=TRUE)

## Prediction of missing edges
g2 <- make_full_graph(4) + (make_full_graph(4) - path(1,2))
predict_edges(g2)

## End(Not run)

[包 igraph 版本 1.3.5 索引]