Skip to content

Commit 2ffd850

Browse files
committed
chore: Ensure args are named
1 parent 8892ac1 commit 2ffd850

File tree

10 files changed

+151
-38
lines changed

10 files changed

+151
-38
lines changed

R/community.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,7 +3055,11 @@ i_compare <- function(
30553055
as.numeric(as.factor(comm2))
30563056
}
30573057
method <- igraph.match.arg(method)
3058-
res <- compare_communities_impl(comm1 = comm1, comm2 = comm2, method = method)
3058+
res <- compare_communities_impl(
3059+
comm1 = comm1,
3060+
comm2 = comm2,
3061+
method = method
3062+
)
30593063
res
30603064
}
30613065

@@ -3103,7 +3107,10 @@ split_join_distance <- function(comm1, comm2) {
31033107
} else {
31043108
as.numeric(comm2)
31053109
}
3106-
res <- split_join_distance_impl(comm1 = comm1, comm2 = comm2)
3110+
res <- split_join_distance_impl(
3111+
comm1 = comm1,
3112+
comm2 = comm2
3113+
)
31073114
unlist(res)
31083115
}
31093116

R/flow.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,11 @@ dominator_tree <- function(graph, root, mode = c("out", "in", "all", "total")) {
909909
mode <- igraph.match.arg(mode)
910910

911911
# Function call
912-
res <- dominator_tree_impl(graph = graph, root = root, mode = mode)
912+
res <- dominator_tree_impl(
913+
graph = graph,
914+
root = root,
915+
mode = mode
916+
)
913917
if (igraph_opt("return.vs.es")) {
914918
res$leftout <- create_vs(graph, res$leftout)
915919
}

R/hrg.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,12 @@ fit_hrg <- function(graph, hrg = NULL, start = FALSE, steps = 0) {
252252
steps <- as.numeric(steps)
253253

254254
# Function call
255-
res <- hrg_fit_impl(graph = graph, hrg = hrg, start = start, steps = steps)
255+
res <- hrg_fit_impl(
256+
graph = graph,
257+
hrg = hrg,
258+
start = start,
259+
steps = steps
260+
)
256261

257262
if (igraph_opt("add.vertex.names") && is_named(graph)) {
258263
res$names <- V(graph)$name

R/interface.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,5 +733,7 @@ incident_edges <- function(graph, v, mode = c("out", "in", "all", "total")) {
733733
#' # Result should be the same
734734
#' is_simple(g)
735735
invalidate_cache <- function(graph) {
736-
invalidate_cache_impl(graph)
736+
invalidate_cache_impl(
737+
graph = graph
738+
)
737739
}

R/make.R

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ line.graph <- function(graph) {
267267
lifecycle::deprecate_soft("2.1.0", "line.graph()", "make_line_graph()")
268268
ensure_igraph(graph)
269269

270-
res <- linegraph_impl(graph = graph)
270+
res <- linegraph_impl(
271+
graph = graph
272+
)
271273
if (igraph_opt("add.params")) {
272274
res$name <- "Line graph"
273275
}
@@ -472,7 +474,10 @@ graph.lattice <- function(
472474
graph.kautz <- function(m, n) {
473475
# nocov start
474476
lifecycle::deprecate_soft("2.1.0", "graph.kautz()", "make_kautz_graph()")
475-
res <- kautz_impl(m = m, n = n)
477+
res <- kautz_impl(
478+
m = m,
479+
n = n
480+
)
476481
if (igraph_opt("add.params")) {
477482
res$name <- sprintf("Kautz graph %i-%i", m, n)
478483
res$m <- m
@@ -499,7 +504,10 @@ graph.full.citation <- function(n, directed = TRUE) {
499504
"make_full_citation_graph()"
500505
)
501506
# Function call
502-
res <- full_citation_impl(n = n, directed = directed)
507+
res <- full_citation_impl(
508+
n = n,
509+
directed = directed
510+
)
503511

504512
res <- set_graph_attr(res, "name", "Full citation graph")
505513
res
@@ -538,7 +546,12 @@ graph.full.bipartite <- function(
538546
"total" = 3
539547
)
540548

541-
res <- full_bipartite_impl(n1 = n1, n2 = n2, directed = directed, mode = mode)
549+
res <- full_bipartite_impl(
550+
n1 = n1,
551+
n2 = n2,
552+
directed = directed,
553+
mode = mode
554+
)
542555
if (igraph_opt("add.params")) {
543556
res$graph$name <- "Full bipartite graph"
544557
res$n1 <- n1
@@ -637,7 +650,10 @@ graph.empty <- function(n = 0, directed = TRUE) {
637650
# nocov start
638651
lifecycle::deprecate_soft("2.1.0", "graph.empty()", "make_empty_graph()")
639652
# Function call
640-
res <- empty_impl(n = n, directed = directed)
653+
res <- empty_impl(
654+
n = n,
655+
directed = directed
656+
)
641657

642658
res
643659
} # nocov end
@@ -659,7 +675,10 @@ graph.de.bruijn <- function(m, n) {
659675
"graph.de.bruijn()",
660676
"make_de_bruijn_graph()"
661677
)
662-
res <- de_bruijn_impl(m = m, n = n)
678+
res <- de_bruijn_impl(
679+
m = m,
680+
n = n
681+
)
663682
if (igraph_opt("add.params")) {
664683
res$name <- sprintf("De-Bruijn graph %i-%i", m, n)
665684
res$m <- m
@@ -729,7 +748,9 @@ graph.bipartite <- function(types, edges, directed = FALSE) {
729748
graph.atlas <- function(n) {
730749
# nocov start
731750
lifecycle::deprecate_soft("2.1.0", "graph.atlas()", "graph_from_atlas()")
732-
res <- atlas_impl(number = n)
751+
res <- atlas_impl(
752+
number = n
753+
)
733754
if (igraph_opt("add.params")) {
734755
res$name <- sprintf("Graph from the Atlas #%i", n)
735756
res$n <- n
@@ -2199,7 +2220,9 @@ from_prufer <- function(...) constructor_spec(make_from_prufer, ...)
21992220
#' graph_from_atlas(sample(0:1252, 1))
22002221
#' graph_from_atlas(sample(0:1252, 1))
22012222
graph_from_atlas <- function(n) {
2202-
res <- atlas_impl(number = n)
2223+
res <- atlas_impl(
2224+
number = n
2225+
)
22032226
if (igraph_opt("add.params")) {
22042227
res$name <- sprintf("Graph from the Atlas #%i", n)
22052228
res$n <- n
@@ -2295,7 +2318,9 @@ chordal_ring <- function(...) constructor_spec(make_chordal_ring, ...)
22952318
make_line_graph <- function(graph) {
22962319
ensure_igraph(graph)
22972320

2298-
res <- linegraph_impl(graph = graph)
2321+
res <- linegraph_impl(
2322+
graph = graph
2323+
)
22992324
if (igraph_opt("add.params")) {
23002325
res$name <- "Line graph"
23012326
}
@@ -2341,7 +2366,10 @@ line_graph <- function(...) constructor_spec(make_line_graph, ...)
23412366
#' make_de_bruijn_graph(2, 2)
23422367
#' make_line_graph(g)
23432368
make_de_bruijn_graph <- function(m, n) {
2344-
res <- de_bruijn_impl(m = m, n = n)
2369+
res <- de_bruijn_impl(
2370+
m = m,
2371+
n = n
2372+
)
23452373
if (igraph_opt("add.params")) {
23462374
res$name <- sprintf("De-Bruijn graph %i-%i", m, n)
23472375
res$m <- m
@@ -2385,7 +2413,10 @@ de_bruijn_graph <- function(...) constructor_spec(make_de_bruijn_graph, ...)
23852413
#' make_kautz_graph(2, 2)
23862414
#'
23872415
make_kautz_graph <- function(m, n) {
2388-
res <- kautz_impl(m = m, n = n)
2416+
res <- kautz_impl(
2417+
m = m,
2418+
n = n
2419+
)
23892420
if (igraph_opt("add.params")) {
23902421
res$name <- sprintf("Kautz graph %i-%i", m, n)
23912422
res$m <- m
@@ -2447,7 +2478,12 @@ make_full_bipartite_graph <- function(
24472478
"total" = 3
24482479
)
24492480

2450-
res <- full_bipartite_impl(n1 = n1, n2 = n2, directed = directed, mode = mode)
2481+
res <- full_bipartite_impl(
2482+
n1 = n1,
2483+
n2 = n2,
2484+
directed = directed,
2485+
mode = mode
2486+
)
24512487
if (igraph_opt("add.params")) {
24522488
res$graph$name <- "Full bipartite graph"
24532489
res$n1 <- n1
@@ -2562,7 +2598,10 @@ bipartite_graph <- function(...) constructor_spec(make_bipartite_graph, ...)
25622598
#' print_all(make_full_citation_graph(10))
25632599
make_full_citation_graph <- function(n, directed = TRUE) {
25642600
# Function call
2565-
res <- full_citation_impl(n = n, directed = directed)
2601+
res <- full_citation_impl(
2602+
n = n,
2603+
directed = directed
2604+
)
25662605

25672606
res <- set_graph_attr(res, "name", "Full citation graph")
25682607
res

R/sgm.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ solve_LSAP <- function(x, maximum = FALSE) {
2424
if (maximum) {
2525
x <- max(x) - x
2626
}
27-
out <- solve_lsap_impl(c = x, n = as.numeric(nc)) + 1L
27+
out <- solve_lsap_impl(
28+
c = x,
29+
n = as.numeric(nc)
30+
) +
31+
1L
2832
out[seq_len(nr)]
2933
}
3034

R/simple.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ simplify_and_colorize <- function(graph) {
119119
ensure_igraph(graph)
120120

121121
# Function call
122-
res <- simplify_and_colorize_impl(graph = graph)
122+
res <- simplify_and_colorize_impl(
123+
graph = graph
124+
)
123125

124126
V(res$res)$color <- res$vertex_color
125127
E(res$res)$color <- res$edge_color

R/structural-properties.R

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ mean_distance <- function(
860860
details = FALSE
861861
) {
862862
average_path_length_dijkstra_impl(
863-
graph,
863+
graph = graph,
864864
weights = weights,
865865
directed = directed,
866866
unconnected = unconnected,
@@ -944,7 +944,7 @@ max_degree <- function(
944944
loops = TRUE
945945
) {
946946
maxdegree_impl(
947-
graph,
947+
graph = graph,
948948
v = v,
949949
mode = mode,
950950
loops = loops
@@ -1585,7 +1585,11 @@ induced_subgraph <- function(
15851585
impl <- igraph.match.arg(impl)
15861586

15871587
# Function call
1588-
res <- induced_subgraph_impl(graph = graph, vids = vids, impl = impl)
1588+
res <- induced_subgraph_impl(
1589+
graph = graph,
1590+
vids = vids,
1591+
impl = impl
1592+
)
15891593

15901594
res
15911595
}
@@ -1796,7 +1800,10 @@ transitivity <- function(
17961800
isolates <- igraph.match.arg(isolates)
17971801

17981802
if (type == 0) {
1799-
transitivity_undirected_impl(graph, isolates)
1803+
transitivity_undirected_impl(
1804+
graph = graph,
1805+
mode = isolates
1806+
)
18001807
} else if (type == 1) {
18011808
isolates_num <- as.double(switch(isolates, "nan" = 0, "zero" = 1))
18021809
if (is.null(vids)) {
@@ -1810,30 +1817,53 @@ transitivity <- function(
18101817
}
18111818
res
18121819
} else {
1813-
res <- transitivity_local_undirected_impl(graph, vids, isolates)
1820+
res <- transitivity_local_undirected_impl(
1821+
graph = graph,
1822+
vids = vids,
1823+
mode = isolates
1824+
)
18141825
if (igraph_opt("add.vertex.names") && is_named(graph)) {
18151826
vids_indices <- as_igraph_vs(graph, vids)
18161827
names(res) <- V(graph)$name[vids_indices]
18171828
}
18181829
res
18191830
}
18201831
} else if (type == 2) {
1821-
transitivity_avglocal_undirected_impl(graph, isolates)
1832+
transitivity_avglocal_undirected_impl(
1833+
graph = graph,
1834+
mode = isolates
1835+
)
18221836
} else if (type == 3) {
18231837
# Save original vids for naming if needed
18241838
vids_for_names <- if (is.null(vids)) V(graph) else vids
18251839

18261840
res <- if (is.null(weights)) {
18271841
if (is.null(vids)) {
1828-
transitivity_local_undirected_impl(graph, mode = isolates)
1842+
transitivity_local_undirected_impl(
1843+
graph = graph,
1844+
mode = isolates
1845+
)
18291846
} else {
1830-
transitivity_local_undirected_impl(graph, vids, isolates)
1847+
transitivity_local_undirected_impl(
1848+
graph = graph,
1849+
vids = vids,
1850+
mode = isolates
1851+
)
18311852
}
18321853
} else {
18331854
if (is.null(vids)) {
1834-
transitivity_barrat_impl(graph, weights = weights, mode = isolates)
1855+
transitivity_barrat_impl(
1856+
graph = graph,
1857+
weights = weights,
1858+
mode = isolates
1859+
)
18351860
} else {
1836-
transitivity_barrat_impl(graph, vids, weights, isolates)
1861+
transitivity_barrat_impl(
1862+
graph = graph,
1863+
vids = vids,
1864+
weights = weights,
1865+
mode = isolates
1866+
)
18371867
}
18381868
}
18391869

@@ -3097,7 +3127,11 @@ components <- function(graph, mode = c("weak", "strong")) {
30973127
mode <- igraph.match.arg(mode)
30983128

30993129
# Function call
3100-
res <- connected_components_impl(graph, mode, details = TRUE)
3130+
res <- connected_components_impl(
3131+
graph = graph,
3132+
mode = mode,
3133+
details = TRUE
3134+
)
31013135
res$membership <- res$membership + 1
31023136
if (igraph_opt("add.vertex.names") && is_named(graph)) {
31033137
names(res$membership) <- V(graph)$name
@@ -3173,7 +3207,11 @@ unfold_tree <- function(graph, mode = c("all", "out", "in", "total"), roots) {
31733207
roots <- as_igraph_vs(graph, roots) - 1
31743208

31753209
# Function call
3176-
res <- unfold_tree_impl(graph = graph, mode = mode, roots = roots)
3210+
res <- unfold_tree_impl(
3211+
graph = graph,
3212+
mode = mode,
3213+
roots = roots
3214+
)
31773215
res
31783216
}
31793217

@@ -3398,7 +3436,11 @@ is_matching <- function(graph, matching, types = NULL) {
33983436
matching[is.na(matching)] <- 0 # Use 0 since is_matching_impl will subtract 1, making it -1
33993437

34003438
# Function call
3401-
res <- is_matching_impl(graph = graph, types = types, matching = matching)
3439+
res <- is_matching_impl(
3440+
graph = graph,
3441+
types = types,
3442+
matching = matching
3443+
)
34023444

34033445
res
34043446
}

0 commit comments

Comments
 (0)