Skip to content

Commit 9a15db1

Browse files
feat: allows skipping initial layout precomputation
1 parent ea2b645 commit 9a15db1

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

R/app.R

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#' base package itself.
1111
#'
1212
#' @param graph An igraph object representing the network to be laid out.
13+
#' @param layout Optional initial layout supplied by the user.
14+
#' @param precompute Whether or not to skip precomputing the initial layout.
1315
#' @return A two column matrix with XY coordinates and N rows, where N is
1416
#' the number of vertices in the graph.
1517
#' @examples
@@ -20,7 +22,7 @@
2022
#' plot(g)
2123
#' }
2224
#' @export
23-
easylayout <- function(graph) {
25+
easylayout <- function(graph, layout = NULL, precompute = TRUE) {
2426
# Nodes must have some sort of identifier.
2527
# Falls back to 1, 2, 3... if "name" is not available.
2628
if (is.null(igraph::V(graph)$name)) {
@@ -40,6 +42,11 @@ easylayout <- function(graph) {
4042
return(start_app(graph, cached_layout$layout))
4143
}
4244

45+
if (!precompute) {
46+
print("Skipping layout precomputation...")
47+
return(start_app(graph))
48+
}
49+
4350
# Magic precomputing
4451
vertices <- igraph::as_data_frame(graph, "vertices")
4552
numeric_columns <- vertices |>

man/easylayout.Rd

+5-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)