File: layout_centrality.Rd

package info (click to toggle)
r-cran-graphlayouts 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,660 kB
  • sloc: cpp: 696; sh: 13; makefile: 2
file content (76 lines) | stat: -rw-r--r-- 2,228 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout_stress.R, R/layouts.R
\name{layout_centrality}
\alias{layout_centrality}
\alias{layout_with_centrality}
\alias{layout_igraph_centrality}
\title{radial centrality layout}
\usage{
layout_with_centrality(
  g,
  cent,
  scale = TRUE,
  iter = 500,
  tol = 1e-04,
  tseq = seq(0, 1, 0.2)
)

layout_igraph_centrality(
  g,
  cent,
  scale = TRUE,
  iter = 500,
  tol = 1e-04,
  tseq = seq(0, 1, 0.2),
  circular
)
}
\arguments{
\item{g}{igraph object}

\item{cent}{centrality scores}

\item{scale}{logical. should centrality scores be scaled to \eqn{[0,100]}? (Default: TRUE)}

\item{iter}{number of iterations during stress optimization}

\item{tol}{stopping criterion for stress optimization}

\item{tseq}{numeric vector. increasing sequence of coefficients to combine regular stress and constraint stress. See details.}

\item{circular}{not used}
}
\value{
matrix of xy coordinates
}
\description{
arranges nodes in concentric circles according to a centrality index.
}
\details{
The function optimizes a convex combination of regular stress and a constrained stress function which forces
nodes to be arranged on concentric circles. The vector \code{tseq} is the sequence of parameters used for the convex combination.
In iteration i of the algorithm \eqn{tseq[i]} is used to combine regular and constraint stress as \eqn{(1-tseq[i])*stress_{regular}+tseq[i]*stress_{constraint}}. The sequence must be increasing, start at zero and end at one. The default setting should be a good choice for most graphs.

The layout_igraph_* function should not be used directly. It is only used as an argument for plotting with 'igraph'.
'ggraph' natively supports the layout.
}
\examples{
library(igraph)

g <- sample_gnp(10, 0.4)
\dontrun{
library(ggraph)
ggraph(g, layout = "centrality", centrality = closeness(g)) +
    draw_circle(use = "cent") +
    geom_edge_link0() +
    geom_node_point(shape = 21, fill = "grey25", size = 5) +
    theme_graph() +
    coord_fixed()
}
}
\references{
Brandes, U., & Pich, C. (2011). More flexible radial layout. Journal of Graph Algorithms and Applications, 15(1), 157-173.
}
\seealso{
\link{layout_centrality_group}
}