File: layout_as_bipartite.Rd

package info (click to toggle)
r-cran-igraph 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,044 kB
  • sloc: ansic: 204,981; cpp: 21,711; fortran: 4,090; yacc: 1,229; lex: 519; sh: 52; makefile: 8
file content (90 lines) | stat: -rw-r--r-- 2,697 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_as_bipartite}
\alias{layout_as_bipartite}
\alias{as_bipartite}
\title{Simple two-row layout for bipartite graphs}
\usage{
layout_as_bipartite(graph, types = NULL, hgap = 1, vgap = 1, maxiter = 100)

as_bipartite(...)
}
\arguments{
\item{graph}{The bipartite input graph. It should have a logical
\sQuote{\code{type}} vertex attribute, or the \code{types} argument must be
given.}

\item{types}{A logical vector, the vertex types. If this argument is
\code{NULL} (the default), then the \sQuote{\code{type}} vertex attribute is
used.}

\item{hgap}{Real scalar, the minimum horizontal gap between vertices in the
same layer.}

\item{vgap}{Real scalar, the distance between the two layers.}

\item{maxiter}{Integer scalar, the maximum number of iterations in the
crossing minimization stage. 100 is a reasonable default; if you feel that
you have too many edge crossings, increase this.}

\item{...}{Arguments to pass to \code{layout_as_bipartite()}.}
}
\value{
A matrix with two columns and as many rows as the number of vertices
in the input graph.
}
\description{
Minimize edge-crossings in a simple two-row (or column) layout for bipartite
graphs.
}
\details{
The layout is created by first placing the vertices in two rows, according
to their types. Then the positions within the rows are optimized to minimize
edge crossings, using the Sugiyama algorithm (see
\code{\link[=layout_with_sugiyama]{layout_with_sugiyama()}}).
}
\examples{
# Random bipartite graph
inc <- matrix(sample(0:1, 50, replace = TRUE, prob = c(2, 1)), 10, 5)
g <- graph_from_biadjacency_matrix(inc)
plot(g,
  layout = layout_as_bipartite,
  vertex.color = c("green", "cyan")[V(g)$type + 1]
)

# Two columns
g \%>\%
  add_layout_(as_bipartite()) \%>\%
  plot()
}
\seealso{
\code{\link[=layout_with_sugiyama]{layout_with_sugiyama()}}

Other graph layouts: 
\code{\link{add_layout_}()},
\code{\link{component_wise}()},
\code{\link{layout_}()},
\code{\link{layout_as_star}()},
\code{\link{layout_as_tree}()},
\code{\link{layout_in_circle}()},
\code{\link{layout_nicely}()},
\code{\link{layout_on_grid}()},
\code{\link{layout_on_sphere}()},
\code{\link{layout_randomly}()},
\code{\link{layout_with_dh}()},
\code{\link{layout_with_fr}()},
\code{\link{layout_with_gem}()},
\code{\link{layout_with_graphopt}()},
\code{\link{layout_with_kk}()},
\code{\link{layout_with_lgl}()},
\code{\link{layout_with_mds}()},
\code{\link{layout_with_sugiyama}()},
\code{\link{merge_coords}()},
\code{\link{norm_coords}()},
\code{\link{normalize}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\concept{graph layouts}
\keyword{graphs}