Skip to content

Commit 18d5772

Browse files
committed
s3
1 parent 6dc5010 commit 18d5772

File tree

5 files changed

+37
-13
lines changed

5 files changed

+37
-13
lines changed

R/aaa-auto.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2968,7 +2968,9 @@ topological_sorting_impl <- function(
29682968
graph,
29692969
mode
29702970
)
2971-
2971+
if (igraph_opt("return.vs.es")) {
2972+
res <- create_vs(graph, res)
2973+
}
29722974
res
29732975
}
29742976

R/structural-properties.R

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,18 +2305,12 @@ coreness <- function(graph, mode = c("all", "out", "in")) {
23052305
#' topo_sort(g)
23062306
#'
23072307
topo_sort <- function(graph, mode = c("out", "all", "in")) {
2308-
ensure_igraph(graph)
23092308
mode <- igraph_match_arg(mode)
2310-
mode <- switch(mode, "out" = 1, "in" = 2, "all" = 3)
2311-
2312-
on.exit(.Call(R_igraph_finalizer))
2313-
res <- .Call(Rx_igraph_topological_sorting, graph, as.numeric(mode)) + 1L
2314-
2315-
if (igraph_opt("return.vs.es")) {
2316-
res <- create_vs(graph, res)
2317-
}
23182309

2319-
res
2310+
topological_sorting_impl(
2311+
graph = graph,
2312+
mode = mode
2313+
)
23202314
}
23212315

23222316
#' Finding a feedback arc set in a graph
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From 487e971253fec664a9b7e49e3162efac8f4ec654 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Kirill=20M=C3=BCller?= <[email protected]>
3+
Date: Sun, 2 Nov 2025 15:44:27 +0100
4+
Subject: [PATCH] Return value of igraph_topological_sorting() is a vector of
5+
vertices
6+
7+
---
8+
src/vendor/cigraph/interfaces/functions.yaml | 3 ++-
9+
1 file changed, 2 insertions(+), 1 deletion(-)
10+
11+
diff --git a/src/vendor/cigraph/interfaces/functions.yaml b/src/vendor/cigraph/interfaces/functions.yaml
12+
index 6ef2506aff..6a4590b36f 100644
13+
--- a/src/vendor/cigraph/interfaces/functions.yaml
14+
+++ b/src/vendor/cigraph/interfaces/functions.yaml
15+
@@ -847,7 +847,8 @@ igraph_neighborhood_graphs:
16+
DEPS: vids ON graph
17+
18+
igraph_topological_sorting:
19+
- PARAMS: GRAPH graph, OUT VECTOR_INT res, NEIMODE mode=OUT
20+
+ PARAMS: GRAPH graph, OUT VERTEX_INDICES res, NEIMODE mode=OUT
21+
+ DEPS: res ON graph
22+
23+
igraph_feedback_arc_set:
24+
# Default algorithm is the approximate method because it is faster and the
25+
--
26+
2.50.1
27+

src/rinterface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4115,7 +4115,7 @@ SEXP R_igraph_topological_sorting(SEXP graph, SEXP mode) {
41154115
IGRAPH_R_CHECK(igraph_topological_sorting(&c_graph, &c_res, c_mode));
41164116

41174117
/* Convert output */
4118-
PROTECT(res=R_igraph_vector_int_to_SEXP(&c_res));
4118+
PROTECT(res=R_igraph_vector_int_to_SEXPp1(&c_res));
41194119
igraph_vector_int_destroy(&c_res);
41204120
IGRAPH_FINALLY_CLEAN(1);
41214121
r_result = res;

src/vendor/cigraph/interfaces/functions.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,8 @@ igraph_neighborhood_graphs:
847847
DEPS: vids ON graph
848848

849849
igraph_topological_sorting:
850-
PARAMS: GRAPH graph, OUT VECTOR_INT res, NEIMODE mode=OUT
850+
PARAMS: GRAPH graph, OUT VERTEX_INDICES res, NEIMODE mode=OUT
851+
DEPS: res ON graph
851852

852853
igraph_feedback_arc_set:
853854
# Default algorithm is the approximate method because it is faster and the

0 commit comments

Comments
 (0)