如果您从 R 中使用 igraph,请使用此选项
layout_with_fr {igraph} | R 文档 |
使用 Fruchterman 和 Reingold 的力导向布局算法在平面上放置顶点。
layout_with_fr(
graph,
coords = NULL,
dim = 2,
niter = 500,
start.temp = sqrt(vcount(graph)),
grid = c("auto", "grid", "nogrid"),
weights = NULL,
minx = NULL,
maxx = NULL,
miny = NULL,
maxy = NULL,
minz = NULL,
maxz = NULL,
coolexp,
maxdelta,
area,
repulserad,
maxiter
)
with_fr(...)
图 |
要布局的图。 边的方向被忽略。 |
coords |
顶点的可选起始位置。 如果此参数不是 |
dim |
整数标量,2 或 3,布局的维度。 二维布局放置在平面上,三维布局放置在 3d 空间中。 |
niter |
整数标量,要执行的迭代次数。 |
start.temp |
实数标量,起始温度。 这是在一个步骤中,一个顶点沿一个轴允许的最大移动量。 目前,在迭代期间,它线性地减小到零。 |
grid |
字符标量,是否使用更快但不太精确的基于网格的算法实现。 默认情况下(“auto”),如果图有超过一千个顶点,则使用基于网格的实现。 |
weights |
给出边权重的向量。 默认情况下,如果存在,则使用 |
minx |
如果不是 |
maxx |
与 |
miny |
与 |
maxy |
与 |
minz |
与 |
maxz |
与 |
coolexp, maxdelta, area, repulserad |
从 igraph 版本 0.8.0 开始不支持这些参数,并且会被忽略(并发出警告)。 |
maxiter |
为了兼容性, |
... |
传递给 |
有关该算法的详细信息,请参阅下面引用的论文。
此函数在 igraph 版本 0.8.0 中从头开始重写。
一个两列或三列矩阵,每行给出顶点的坐标,根据顶点 ID 的 ID。
Gabor Csardi csardi.gabor@gmail.com
Fruchterman, T.M.J. and Reingold, E.M. (1991). Graph Drawing by Force-directed Placement. Software - Practice and Experience, 21(11):1129-1164.
layout_with_drl
, layout_with_kk
用于其他布局算法。
其他图布局: add_layout_()
, component_wise()
, layout_as_bipartite()
, layout_as_star()
, layout_as_tree()
, layout_in_circle()
, layout_nicely()
, layout_on_grid()
, layout_on_sphere()
, layout_randomly()
, layout_with_dh()
, layout_with_gem()
, layout_with_graphopt()
, layout_with_kk()
, layout_with_lgl()
, layout_with_mds()
, layout_with_sugiyama()
, layout_()
, merge_coords()
, norm_coords()
, normalize()
# Fixing ego
g <- sample_pa(20, m=2)
minC <- rep(-Inf, vcount(g))
maxC <- rep(Inf, vcount(g))
minC[1] <- maxC[1] <- 0
co <- layout_with_fr(g, minx=minC, maxx=maxC,
miny=minC, maxy=maxC)
co[1,]
plot(g, layout=co, vertex.size=30, edge.arrow.size=0.2,
vertex.label=c("ego", rep("", vcount(g)-1)), rescale=FALSE,
xlim=range(co[,1]), ylim=range(co[,2]), vertex.label.dist=0,
vertex.label.color="red")
axis(1)
axis(2)