| layout_tbl_graph_igraph {ggraph} | R Documentation |
Use igraph layout algorithms for layout_tbl_graph
Description
This layout function makes it easy to apply one of the layout algorithms
supplied in igraph when plotting with ggraph. Layout names are auto completed
so there is no need to write layout_with_graphopt or
layout_as_tree, just graphopt and tree (though the
former will also work if you want to be super explicit). Circular layout is
only supported for tree-like layout (tree and sugiyama) and
will throw an error when applied to other layouts.
Usage
layout_tbl_graph_igraph(
graph,
algorithm,
circular,
offset = pi/2,
use.dummy = FALSE,
...
)
Arguments
graph |
A |
algorithm |
The type of layout algorithm to apply. See Details or
|
circular |
Logical. Should the layout be transformed to a circular
representation. Defaults to |
offset |
If |
use.dummy |
Logical. In the case of |
... |
Arguments passed on to the respective layout functions |
Details
igraph provides a huge amount of possible layouts. They are all briefly described below:
Hierarchical layouts
treeUses the Reingold-Tilford algorithm to place the nodes below their parent with the parent centered above its children. See
igraph::as_tree()sugiyamaDesigned for directed acyclic graphs (that is, hierarchies where multiple parents are allowed) it minimizes the number of crossing edges. See
igraph::with_sugiyama()
Standard layouts
bipartiteMinimize edge-crossings in a simple two-row (or column) layout for bipartite graphs. See
igraph::as_bipartite()starPlace one node in the center and the rest equidistantly around it. See
igraph::as_star()circlePlace nodes in a circle in the order of their index. Consider using
layout_tbl_graph_linear()withcircular=TRUEfor more control. Seeigraph::in_circle()nicelyTries to pick an appropriate layout. See
igraph::nicely()for a description of the simple decision tree it usesdhUses Davidson and Harels simulated annealing algorithm to place nodes. See
igraph::with_dh()gemPlace nodes on the plane using the GEM force-directed layout algorithm. See
igraph::with_gem()graphoptUses the Graphopt algorithm based on alternating attraction and repulsion to place nodes. See
igraph::with_graphopt()gridPlace nodes on a rectangular grid. See
igraph::on_grid()mdsPerform a multidimensional scaling of nodes using either the shortest path or a user supplied distance. See
igraph::with_mds()spherePlace nodes uniformly on a sphere - less relevant for 2D visualizations of networks. See
igraph::on_sphere()randomlyPlaces nodes uniformly random. See
igraph::randomly()frPlaces nodes according to the force-directed algorithm of Fruchterman and Reingold. See
igraph::with_fr()kkUses the spring-based algorithm by Kamada and Kawai to place nodes. See
igraph::with_kk()drlUses the force directed algorithm from the DrL toolbox to place nodes. See
igraph::with_drl()lglUses the algorithm from Large Graph Layout to place nodes. See
igraph::with_lgl()
Value
A data.frame with the columns x, y, circular as
well as any information stored as node variables in the tbl_graph object.
Note
This function is not intended to be used directly but by setting
layout = 'igraph' in create_layout()
See Also
Other layout_tbl_graph_*:
layout_tbl_graph_auto(),
layout_tbl_graph_backbone(),
layout_tbl_graph_cactustree(),
layout_tbl_graph_centrality(),
layout_tbl_graph_circlepack(),
layout_tbl_graph_dendrogram(),
layout_tbl_graph_eigen(),
layout_tbl_graph_fabric(),
layout_tbl_graph_focus(),
layout_tbl_graph_hive(),
layout_tbl_graph_htree(),
layout_tbl_graph_linear(),
layout_tbl_graph_manual(),
layout_tbl_graph_matrix(),
layout_tbl_graph_metro(),
layout_tbl_graph_partition(),
layout_tbl_graph_pmds(),
layout_tbl_graph_sf(),
layout_tbl_graph_stress(),
layout_tbl_graph_treemap(),
layout_tbl_graph_unrooted()