Skip to content

Commit 03fb51b

Browse files
committed
Merge branch 'main' into next
2 parents bd6abe5 + b00dc2c commit 03fb51b

File tree

20 files changed

+246
-165
lines changed

20 files changed

+246
-165
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,12 @@ jobs:
223223
env:
224224
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225225
run: |
226-
# Check status of this workflow
227-
state="pending"
226+
# Set status to success if job succeeded, failure otherwise
227+
if [ "${{ job.status }}" == "success" ]; then
228+
state="success"
229+
else
230+
state="failure"
231+
fi
228232
sha=${{ inputs.ref }}
229233
if [ -z "${sha}" ]; then
230234
sha=${{ github.sha }}

.github/workflows/vendor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- "vendor-one.sh"
88
workflow_dispatch:
99
schedule:
10-
- cron: "0 * * * *"
10+
- cron: "* 0 * * *"
1111

1212
concurrency:
1313
group: ${{ github.workflow }}

AGENTS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ All new functions must include:
9191
- A concept so that it exists in the pkgdown reference index
9292
- An "experimental" badge via `r lifecycle::badge("experimental")`
9393

94-
If exporting a new function from the C library, ensure it is autogenerated and add tests for the `_impl` function.
94+
If exporting a new function from the C library:
95+
96+
- Ensure it is autogenerated
97+
- Add tests for the `_impl` function
98+
- Name all arguments in all calls to the `_impl` function
9599

96100
## File Structure and Organization
97101

@@ -113,9 +117,11 @@ See `tools/README.md` for guidelines on code generation using the Stimulus frame
113117

114118
### Build Artifacts
115119

116-
Do not commit: `*.dd`, `*.d`, `*.o`, `*.so` files in `src/`, and `tests/testthat/testthat-problems.rds`.
120+
Do not commit: `*.d`, `*.o`, `*.so` files in `src/`, and `tests/testthat/testthat-problems.rds`.
117121
These are build artifacts that are regenerated automatically (see `src/README.md` for details on dependency tracking).
118122

123+
Careful with changes to `*.dd`, keep system headers out, only expect changes if new source files are added or their local dependencies change.
124+
119125
## Testing
120126

121127
- Add test cases for all new functionality

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: igraph
22
Title: Network Analysis and Visualization
3-
Version: 2.2.1.9000
3+
Version: 2.2.1.9001
44
Authors@R: c(
55
person("Gábor", "Csárdi", , "[email protected]", role = "aut",
66
comment = c(ORCID = "0000-0001-7098-9676")),

R/centralization.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,12 @@ centr_betw <- function(graph, directed = TRUE, normalized = TRUE) {
481481
directed <- as.logical(directed)
482482
normalized <- as.logical(normalized)
483483

484-
on.exit(.Call(R_igraph_finalizer))
485484
# Function call
486-
res <- .Call(R_igraph_centralization_betweenness, graph, directed, normalized)
485+
res <- centralization_betweenness_impl(
486+
graph = graph,
487+
directed = directed,
488+
normalized = normalized
489+
)
487490

488491
res
489492
}

R/community.R

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -984,9 +984,13 @@ modularity_matrix <- function(
984984
resolution <- as.numeric(resolution)
985985
directed <- as.logical(directed)
986986

987-
on.exit(.Call(R_igraph_finalizer))
988987
# Function call
989-
res <- .Call(R_igraph_modularity_matrix, graph, weights, resolution, directed)
988+
res <- modularity_matrix_impl(
989+
graph = graph,
990+
weights = weights,
991+
resolution = resolution,
992+
directed = directed
993+
)
990994

991995
res
992996
}
@@ -2524,9 +2528,12 @@ cluster_louvain <- function(graph, weights = NULL, resolution = 1) {
25242528
}
25252529
resolution <- as.numeric(resolution)
25262530

2527-
on.exit(.Call(R_igraph_finalizer))
25282531
# Function call
2529-
res <- .Call(R_igraph_community_multilevel, graph, weights, resolution)
2532+
res <- community_multilevel_impl(
2533+
graph = graph,
2534+
weights = weights,
2535+
resolution = resolution
2536+
)
25302537
if (igraph_opt("add.vertex.names") && is_named(graph)) {
25312538
res$names <- V(graph)$name
25322539
}
@@ -3055,16 +3062,12 @@ i_compare <- function(
30553062
} else {
30563063
as.numeric(as.factor(comm2))
30573064
}
3058-
method <- switch(
3059-
igraph.match.arg(method),
3060-
vi = 0L,
3061-
nmi = 1L,
3062-
split.join = 2L,
3063-
rand = 3L,
3064-
adjusted.rand = 4L
3065+
method <- igraph.match.arg(method)
3066+
res <- compare_communities_impl(
3067+
comm1 = comm1,
3068+
comm2 = comm2,
3069+
method = method
30653070
)
3066-
on.exit(.Call(R_igraph_finalizer))
3067-
res <- .Call(R_igraph_compare_communities, comm1, comm2, method)
30683071
res
30693072
}
30703073

@@ -3112,8 +3115,10 @@ split_join_distance <- function(comm1, comm2) {
31123115
} else {
31133116
as.numeric(comm2)
31143117
}
3115-
on.exit(.Call(R_igraph_finalizer))
3116-
res <- .Call(R_igraph_split_join_distance, comm1, comm2)
3118+
res <- split_join_distance_impl(
3119+
comm1 = comm1,
3120+
comm2 = comm2
3121+
)
31173122
unlist(res)
31183123
}
31193124

R/conversion.R

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -624,17 +624,14 @@ as_undirected <- function(
624624
) {
625625
# Argument checks
626626
ensure_igraph(graph)
627-
mode <- switch(
628-
igraph.match.arg(mode),
629-
"collapse" = 1L,
630-
"each" = 0L,
631-
"mutual" = 2L
632-
)
633-
edge.attr.comb <- igraph.i.attribute.combination(edge.attr.comb)
627+
mode <- igraph.match.arg(mode)
634628

635-
on.exit(.Call(R_igraph_finalizer))
636629
# Function call
637-
res <- .Call(R_igraph_to_undirected, graph, mode, edge.attr.comb)
630+
res <- to_undirected_impl(
631+
graph = graph,
632+
mode = mode,
633+
edge.attr.comb = edge.attr.comb
634+
)
638635

639636
res
640637
}

R/flow.R

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -906,17 +906,14 @@ dominator_tree <- function(graph, root, mode = c("out", "in", "all", "total")) {
906906
}
907907
root <- as_igraph_vs(graph, root)
908908

909-
mode <- switch(
910-
igraph.match.arg(mode),
911-
"out" = 1,
912-
"in" = 2,
913-
"all" = 3,
914-
"total" = 3
915-
)
909+
mode <- igraph.match.arg(mode)
916910

917-
on.exit(.Call(R_igraph_finalizer))
918911
# Function call
919-
res <- .Call(R_igraph_dominator_tree, graph, root - 1, mode)
912+
res <- dominator_tree_impl(
913+
graph = graph,
914+
root = root,
915+
mode = mode
916+
)
920917
if (igraph_opt("return.vs.es")) {
921918
res$leftout <- create_vs(graph, res$leftout)
922919
}

R/hrg.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,13 @@ fit_hrg <- function(graph, hrg = NULL, start = FALSE, steps = 0) {
251251
start <- as.logical(start)
252252
steps <- as.numeric(steps)
253253

254-
on.exit(.Call(R_igraph_finalizer))
255254
# Function call
256-
res <- .Call(R_igraph_hrg_fit, graph, hrg, start, steps)
255+
res <- hrg_fit_impl(
256+
graph = graph,
257+
hrg = hrg,
258+
start = start,
259+
steps = steps
260+
)
257261

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

R/incidence.R

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ graph_incidence_build <- function(
8080

8181
# Handle dense unweighted matrices first
8282
if (!inherits(incidence, "Matrix") && is.null(weighted)) {
83-
mode(incidence) <- "double"
84-
on.exit(.Call(R_igraph_finalizer))
85-
86-
mode_num <- switch(mode, "out" = 1, "in" = 2, "all" = 3, "total" = 3)
87-
res <- .Call(R_igraph_biadjacency, incidence, directed, mode_num, multiple)
83+
res <- biadjacency_impl(
84+
incidence = incidence,
85+
directed = directed,
86+
mode = mode,
87+
multiple = multiple
88+
)
8889
return(set_vertex_attr(res$graph, "type", value = res$types))
8990
}
9091

0 commit comments

Comments
 (0)