Skip to content

Commit 3bb125f

Browse files
committed
rename simplex tree coercers to specify interfaces
1 parent 1ab4372 commit 3bb125f

15 files changed

Lines changed: 107 additions & 107 deletions

NAMESPACE

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ S3method(as_network,default)
1515
S3method(as_network,gudhi.simplex_tree.SimplexTree)
1616
S3method(as_network,igraph)
1717
S3method(as_network,network)
18-
S3method(as_py_gudhi,Rcpp_SimplexTree)
19-
S3method(as_py_gudhi,default)
20-
S3method(as_py_gudhi,igraph)
21-
S3method(as_py_gudhi,network)
22-
S3method(as_simplextree,Rcpp_SimplexTree)
23-
S3method(as_simplextree,default)
24-
S3method(as_simplextree,gudhi.simplex_tree.SimplexTree)
25-
S3method(as_simplextree,igraph)
26-
S3method(as_simplextree,network)
18+
S3method(as_py_gudhi_simplextree,Rcpp_SimplexTree)
19+
S3method(as_py_gudhi_simplextree,default)
20+
S3method(as_py_gudhi_simplextree,igraph)
21+
S3method(as_py_gudhi_simplextree,network)
22+
S3method(as_rcpp_simplextree,Rcpp_SimplexTree)
23+
S3method(as_rcpp_simplextree,default)
24+
S3method(as_rcpp_simplextree,gudhi.simplex_tree.SimplexTree)
25+
S3method(as_rcpp_simplextree,igraph)
26+
S3method(as_rcpp_simplextree,network)
2727
export(as_cmplx)
2828
export(as_igraph)
2929
export(as_network)
30-
export(as_py_gudhi)
31-
export(as_simplextree)
30+
export(as_py_gudhi_simplextree)
31+
export(as_rcpp_simplextree)

R/as-igraph.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ as_igraph.Rcpp_SimplexTree <- function(x, index = NULL, ...) {
6565
res
6666
}
6767

68-
#' @rdname as_simplextree
68+
#' @rdname as_igraph
6969
#' @export
7070
as_igraph.gudhi.simplex_tree.SimplexTree <- function(x, index = NULL, ...) {
7171

R/as-py-gudhi.r

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#'
66
#' @details
77
#'
8-
#' `as_py_gudhi()` is a generic function with specific methods for different
9-
#' simplicial complex S3 classes. It returns an object of class
8+
#' `as_py_gudhi_simplextree()` is a generic function with specific methods for
9+
#' different simplicial complex S3 classes. It returns an object of class
1010
#' 'gudhi.simplex_tree.SimplexTree', which is a
1111
#' [reticulate][reticulate::reticulate] accessor to a Python object of class
1212
#' 'SimplexTree' implemented in GUDHI.
@@ -23,11 +23,11 @@
2323
#' @author Jason Cory Brunson
2424
#' @author Yara Skaf
2525
#' @export
26-
as_py_gudhi <- function(x, ...) UseMethod("as_py_gudhi")
26+
as_py_gudhi_simplextree <- function(x, ...) UseMethod("as_py_gudhi_simplextree")
2727

28-
#' @rdname as_py_gudhi
28+
#' @rdname as_py_gudhi_simplextree
2929
#' @export
30-
as_py_gudhi.default <- function(x, ...) {
30+
as_py_gudhi_simplextree.default <- function(x, ...) {
3131
x <- ensure_cmplx(x)
3232
x <- ensure_list(x)
3333
# import GUDHI
@@ -40,9 +40,9 @@ as_py_gudhi.default <- function(x, ...) {
4040
res
4141
}
4242

43-
#' @rdname as_py_gudhi
43+
#' @rdname as_py_gudhi_simplextree
4444
#' @export
45-
as_py_gudhi.Rcpp_SimplexTree <- function(x, ...) {
45+
as_py_gudhi_simplextree.Rcpp_SimplexTree <- function(x, ...) {
4646
# import GUDHI
4747
gd <- reticulate::import("gudhi")
4848

@@ -68,9 +68,9 @@ as_py_gudhi.Rcpp_SimplexTree <- function(x, ...) {
6868
res
6969
}
7070

71-
#' @rdname as_py_gudhi
71+
#' @rdname as_py_gudhi_simplextree
7272
#' @export
73-
as_py_gudhi.igraph <- function(x, index = NULL, ...) {
73+
as_py_gudhi_simplextree.igraph <- function(x, index = NULL, ...) {
7474
if (! is.null(index)) ensure_index(x, index)
7575
# import GUDHI
7676
gd <- reticulate::import("gudhi")
@@ -91,13 +91,13 @@ as_py_gudhi.igraph <- function(x, index = NULL, ...) {
9191
res
9292
}
9393

94-
#' @rdname as_py_gudhi
94+
#' @rdname as_py_gudhi_simplextree
9595
#' @export
96-
as_py_gudhi.network <- function(x, index = NULL, ...) {
96+
as_py_gudhi_simplextree.network <- function(x, index = NULL, ...) {
9797

9898
# coerce to an igraph object
9999
x <- intergraph::asIgraph(x, ...)
100100

101101
# invoke 'igraph' method
102-
as_py_gudhi(x, index = index)
102+
as_py_gudhi_simplextree(x, index = index)
103103
}

R/as-simplextree.r

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#'
66
#' @details
77
#'
8-
#' `as_simplextree()` is a generic function with specific methods for different
9-
#' simplicial complex S3 classes. It returns an object of class
8+
#' `as_rcpp_simplextree()` is a generic function with specific methods for
9+
#' different simplicial complex S3 classes. It returns an object of class
1010
#' ['Rcpp_SimplexTree'][simplextree::Rcpp_SimplexTree], which is an [Rcpp
1111
#' Module][Rcpp::Module] that exposes an instance of a C++ instance of a simplex
1212
#' tree.
@@ -21,11 +21,11 @@
2121
#' 'Rcpp_SimplexTree'.
2222
#' @example inst/examples/ex-as-simplextree.r
2323
#' @export
24-
as_simplextree <- function(x, ...) UseMethod("as_simplextree")
24+
as_rcpp_simplextree <- function(x, ...) UseMethod("as_rcpp_simplextree")
2525

26-
#' @rdname as_simplextree
26+
#' @rdname as_rcpp_simplextree
2727
#' @export
28-
as_simplextree.default <- function(x, ...) {
28+
as_rcpp_simplextree.default <- function(x, ...) {
2929
x <- ensure_cmplx(x)
3030
x <- ensure_list(x)
3131

@@ -35,13 +35,13 @@ as_simplextree.default <- function(x, ...) {
3535
res
3636
}
3737

38-
#' @rdname as_simplextree
38+
#' @rdname as_rcpp_simplextree
3939
#' @export
40-
as_simplextree.Rcpp_SimplexTree <- function(x, ...) x
40+
as_rcpp_simplextree.Rcpp_SimplexTree <- function(x, ...) x
4141

42-
#' @rdname as_simplextree
42+
#' @rdname as_rcpp_simplextree
4343
#' @export
44-
as_simplextree.gudhi.simplex_tree.SimplexTree <- function(x, ...) {
44+
as_rcpp_simplextree.gudhi.simplex_tree.SimplexTree <- function(x, ...) {
4545

4646
# initialize simplex tree
4747
res <- simplextree::simplex_tree()
@@ -51,9 +51,9 @@ as_simplextree.gudhi.simplex_tree.SimplexTree <- function(x, ...) {
5151
res
5252
}
5353

54-
#' @rdname as_simplextree
54+
#' @rdname as_rcpp_simplextree
5555
#' @export
56-
as_simplextree.igraph <- function(x, index = NULL, ...) {
56+
as_rcpp_simplextree.igraph <- function(x, index = NULL, ...) {
5757
if (! is.null(index)) ensure_index(x, index)
5858

5959
# generate vertex list
@@ -75,13 +75,13 @@ as_simplextree.igraph <- function(x, index = NULL, ...) {
7575
res
7676
}
7777

78-
#' @rdname as_simplextree
78+
#' @rdname as_rcpp_simplextree
7979
#' @export
80-
as_simplextree.network <- function(x, index = NULL, ...) {
80+
as_rcpp_simplextree.network <- function(x, index = NULL, ...) {
8181

8282
# coerce to an igraph object
8383
x <- intergraph::asIgraph(x, ...)
8484

8585
# invoke 'igraph' method
86-
as_simplextree(x, index = index)
86+
as_rcpp_simplextree(x, index = index)
8787
}

cran-comments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The check flagged the same spellings as the R-hub check.
2828

2929
## Version dependencies
3030

31-
The method `as_py_gudhi.Rcpp_SimplexTree()` operates differently depending on the version of {simplextree} installed. This has not been flagged by documentation and checks but may be important for the maintainers to know.
31+
The method `as_py_gudhi_simplextree.Rcpp_SimplexTree()` operates differently depending on the version of {simplextree} installed. This has not been flagged by documentation and checks but may be important for the maintainers to know.
3232

3333
## Reverse dependencies
3434

inst/examples/ex-as-py-gudhi.r

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,35 @@ rf <- TDA::ripsFiltration(
1616
maxdimension = 2L, maxscale = 1.7
1717
)
1818
print(rf$cmplx)
19-
gd_rf <- as_py_gudhi(rf)
19+
gd_rf <- as_py_gudhi_simplextree(rf)
2020
print_py_gudhi(gd_rf)
21-
gd_rf2 <- as_py_gudhi(rf$cmplx)
21+
gd_rf2 <- as_py_gudhi_simplextree(rf$cmplx)
2222
print_py_gudhi(gd_rf2)
2323

2424
# convert a simplextree object
2525
st <- simplextree::simplex_tree()
2626
st$insert(list(3:5, 5:6, 8))
27-
gd_st <- as_py_gudhi(st)
27+
gd_st <- as_py_gudhi_simplextree(st)
2828
print_py_gudhi(gd_st)
2929

3030
# convert an igraph object
3131
ig <- igraph::graph(c(1,2, 2,3, 1,3, 3,4))
3232
print(ig)
33-
gd_ig <- as_py_gudhi(ig)
33+
gd_ig <- as_py_gudhi_simplextree(ig)
3434
print_py_gudhi(gd_ig)
3535

3636
# specify 0-simplex indices
3737
set.seed(0L)
3838
ig <- igraph::set_vertex_attr(ig, "id", value = sample(igraph::vcount(ig)) + 1L)
3939
igraph::V(ig)$id
4040
igraph::as_edgelist(ig)
41-
gd_ig2 <- as_py_gudhi(ig, index = "id")
41+
gd_ig2 <- as_py_gudhi_simplextree(ig, index = "id")
4242
print_py_gudhi(gd_ig2)
4343

4444
# convert a network object
4545
el <- data.frame(tails = c(1, 2, 1, 3), heads = c(2, 3, 3, 4))
4646
nw <- network::network.edgelist(el, network::network.initialize(4))
4747
print(nw)
48-
gd_nw <- as_py_gudhi(nw)
48+
gd_nw <- as_py_gudhi_simplextree(nw)
4949
print_py_gudhi(gd_nw)
5050
}

inst/examples/ex-as-simplextree.r

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ rf <- TDA::ripsFiltration(
55
maxdimension = 2L, maxscale = 1.7
66
)
77
print(rf$cmplx)
8-
st_rf <- as_simplextree(rf)
8+
st_rf <- as_rcpp_simplextree(rf)
99
print(st_rf)
10-
st_rf2 <- as_simplextree(rf$cmplx)
10+
st_rf2 <- as_rcpp_simplextree(rf$cmplx)
1111
print(st_rf2)
1212

1313
\dontrun{
@@ -16,28 +16,28 @@ print(st_rf2)
1616
gd <- reticulate::import("gudhi")
1717
gd_st <- gd$SimplexTree()
1818
for (s in list(3:5, 5:6, 8)) gd_st$insert(as.list(s))
19-
st_gd <- as_simplextree(gd_st)
19+
st_gd <- as_rcpp_simplextree(gd_st)
2020
st_gd$as_list()
2121
}
2222

2323
# convert an igraph object
2424
ig <- igraph::graph(c(1,2, 2,3, 1,3, 3,4))
2525
print(ig)
26-
st_ig <- as_simplextree(ig)
26+
st_ig <- as_rcpp_simplextree(ig)
2727
print(st_ig)
2828

2929
# specify 0-simplex indices
3030
set.seed(0L)
3131
ig <- igraph::set_vertex_attr(ig, "id", value = sample(igraph::vcount(ig)) + 1L)
3232
igraph::V(ig)$id
3333
igraph::as_edgelist(ig)
34-
st_ig <- as_simplextree(ig, index = "id")
34+
st_ig <- as_rcpp_simplextree(ig, index = "id")
3535
st_ig$vertices
3636
st_ig$edges
3737

3838
# convert a network object
3939
el <- data.frame(tails = c(1, 2, 1, 3), heads = c(2, 3, 3, 4))
4040
nw <- network::network.edgelist(el, network::network.initialize(4))
4141
print(nw)
42-
st_nw <- as_simplextree(nw)
42+
st_nw <- as_rcpp_simplextree(nw)
4343
print(st_nw)

man/as_igraph.Rd

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)