layout_as_bipartite

0th

Percentile

Simple two-row layout for bipartite graphs

Minimize edge-crossings in a simple two-row (or column) layout for bipartite graphs.

Keywords
graphs
Usage
layout_as_bipartite(graph, types = NULL, hgap = 1, vgap = 1,
maxiter = 100)as_bipartite(...)
Arguments
graph
The bipartite input graph. It should have a logical type vertex attribute, or the types argument must be given.
types
A logical vector, the vertex types. If this argument is NULL (the default), then the type vertex attribute is used.
hgap
Real scalar, the minimum horizontal gap between vertices in the same layer.
vgap
Real scalar, the distance between the two layers.
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.
...
Arguments to pass to layout_as_bipartite.
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 layout_with_sugiyama).

Value

• A matrix with two columns and as many rows as the number of vertices in the input graph.

layout_with_sugiyama

Other graph layouts: add_layout_; as_star, layout.star, layout_as_star; as_tree, layout_as_tree; component_wise; in_circle, layout_in_circle; layout.auto, layout_nicely, nicely; layout.davidson.harel, layout_with_dh, with_dh; layout.gem, layout_with_gem, with_gem; layout.graphopt, layout_with_graphopt, with_graphopt; layout.grid, layout.grid.3d, layout.grid.3d, layout_on_grid, on_grid; layout.mds, layout_with_mds, with_mds; layout.merge, layout_components, merge_coords, piecewise.layout, piecewise.layout; layout.norm, norm_coords; layout.sugiyama, layout_with_sugiyama, with_sugiyama; layout_on_sphere, on_sphere; layout_randomly, randomly; layout_with_fr, with_fr; layout_with_kk, with_kk; layout_with_lgl, with_lgl; layout, layout_, print.igraph_layout_modifier, print.igraph_layout_spec; normalize

Aliases
• as_bipartite
• layout.bipartite
• layout_as_bipartite
Examples
# Random bipartite graph
inc <- matrix(sample(0:1, 50, replace = TRUE, prob=c(2,1)), 10, 5)
g <- graph_from_incidence_matrix(inc)
plot(g, layout = layout_as_bipartite,
vertex.color=c("green","cyan")[V(g)\$type+1])

# Two columns
g %>%
plot()