Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix use of deprecated functions in examples #827

Merged
merged 5 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/community.R
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ cluster_leiden <- function(graph, objective_function = c("CPM", "modularity"),
#' @export
#' @keywords graphs
#' @examples
#' g <- graph.famous("Zachary")
#' g <- make_graph("Zachary")
#' comms <- cluster_fluid_communities(g, 2)
cluster_fluid_communities <- function(graph, no.of.communities) {
# Argument checks
Expand Down
2 changes: 1 addition & 1 deletion R/fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
#' @examples
#'
#' # This should approximately yield the correct exponent 3
#' g <- barabasi.game(1000) # increase this number to have a better estimate
#' g <- sample_pa(1000) # increase this number to have a better estimate
#' d <- degree(g, mode = "in")
#' fit1 <- fit_power_law(d + 1, 10)
#' fit2 <- fit_power_law(d + 1, 10, implementation = "R.mle")
Expand Down
18 changes: 9 additions & 9 deletions R/flow.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ min_cut <- function(graph, source = NULL, target = NULL, capacity = NULL, value.
#' @keywords graphs
#' @examples
#'
#' g <- barabasi.game(100, m = 1)
#' g <- sample_pa(100, m = 1)
#' g <- delete_edges(g, E(g)[100 %--% 1])
#' g2 <- barabasi.game(100, m = 5)
#' g2 <- sample_pa(100, m = 5)
#' g2 <- delete_edges(g2, E(g2)[100 %--% 1])
#' vertex_connectivity(g, 100, 1)
#' vertex_connectivity(g2, 100, 1)
Expand Down Expand Up @@ -299,8 +299,8 @@ vertex_connectivity <- function(graph, source = NULL, target = NULL, checks = TR
#' @keywords graphs
#' @examples
#'
#' g <- barabasi.game(100, m = 1)
#' g2 <- barabasi.game(100, m = 5)
#' g <- sample_pa(100, m = 1)
#' g2 <- sample_pa(100, m = 5)
#' edge_connectivity(g, 100, 1)
#' edge_connectivity(g2, 100, 1)
#' edge_disjoint_paths(g2, 100, 1)
Expand Down Expand Up @@ -785,11 +785,11 @@ is_min_separator <- is_minimal_separator_impl
#' )
#'
#' # Cohesive subgraphs
#' mw1 <- induced.subgraph(mw, as.character(c(1:7, 17:23)))
#' mw2 <- induced.subgraph(mw, as.character(7:16))
#' mw3 <- induced.subgraph(mw, as.character(17:23))
#' mw4 <- induced.subgraph(mw, as.character(c(7, 8, 11, 14)))
#' mw5 <- induced.subgraph(mw, as.character(1:7))
#' mw1 <- induced_subgraph(mw, as.character(c(1:7, 17:23)))
#' mw2 <- induced_subgraph(mw, as.character(7:16))
#' mw3 <- induced_subgraph(mw, as.character(17:23))
#' mw4 <- induced_subgraph(mw, as.character(c(7, 8, 11, 14)))
#' mw5 <- induced_subgraph(mw, as.character(1:7))
#'
#' min_separators(mw)
#' min_separators(mw1)
Expand Down
6 changes: 3 additions & 3 deletions R/motifs.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#' @family graph motifs
#'
#' @examples
#' g <- barabasi.game(100)
#' g <- sample_pa(100)
#' motifs(g, 3)
#' count_motifs(g, 3)
#' sample_motifs(g, 3)
Expand Down Expand Up @@ -91,7 +91,7 @@ motifs <- function(graph, size = 3, cut.prob = rep(0, size)) {
#' @family graph motifs
#'
#' @examples
#' g <- barabasi.game(100)
#' g <- sample_pa(100)
#' motifs(g, 3)
#' count_motifs(g, 3)
#' sample_motifs(g, 3)
Expand Down Expand Up @@ -139,7 +139,7 @@ count_motifs <- function(graph, size = 3, cut.prob = rep(0, size)) {
#' @family graph motifs
#'
#' @examples
#' g <- barabasi.game(100)
#' g <- sample_pa(100)
#' motifs(g, 3)
#' count_motifs(g, 3)
#' sample_motifs(g, 3)
Expand Down
2 changes: 1 addition & 1 deletion R/rewire.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ rewire_keeping_degseq <- function(graph, loops, niter) {
#'
#' # Rewiring the start of each directed edge preserves the in-degree distribution
#' # but not the out-degree distribution
#' g <- barabasi.game(1000)
#' g <- sample_pa(1000)
#' g2 <- g %>% rewire(each_edge(mode = "in", multiple = TRUE, prob = 0.2))
#' degree(g, mode = "in") == degree(g2, mode = "in")
each_edge <- function(prob, loops = FALSE, multiple = FALSE, mode = c("all", "out", "in", "total")) {
Expand Down
4 changes: 2 additions & 2 deletions R/sgm.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ solve_LSAP <- function(x, maximum = FALSE) {
#' g1 <- sample_gnp(10, 0.1)
#' randperm <- c(1:3, 3 + sample(7))
#' g2 <- sample_correlated_gnp(g1, corr = 1, p = g1$p, permutation = randperm)
#' A <- as.matrix(get.adjacency(g1))
#' B <- as.matrix(get.adjacency(g2))
#' A <- as_adjacency_matrix(g1)
#' B <- as_adjacency_matrix(g2)
#' P <- match_vertices(A, B, m = 3, start = diag(rep(1, nrow(A) - 3)), 20)
#' P
#' @family sgm
Expand Down
10 changes: 5 additions & 5 deletions R/structural.properties.R
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ coreness <- function(graph, mode = c("all", "out", "in")) {
#' @export
#' @examples
#'
#' g <- barabasi.game(100)
#' g <- sample_pa(100)
#' topo_sort(g)
#'
topo_sort <- function(graph, mode = c("out", "all", "in")) {
Expand Down Expand Up @@ -1486,19 +1486,19 @@ girth <- function(graph, circle = TRUE) {
#' which_loop(g)
#'
#' # Multiple edges
#' g <- barabasi.game(10, m = 3, algorithm = "bag")
#' g <- sample_pa(10, m = 3, algorithm = "bag")
#' any_multiple(g)
#' which_multiple(g)
#' count_multiple(g)
#' which_multiple(simplify(g))
#' all(count_multiple(simplify(g)) == 1)
#'
#' # Direction of the edge is important
#' which_multiple(graph(c(1, 2, 2, 1)))
#' which_multiple(graph(c(1, 2, 2, 1), dir = FALSE))
#' which_multiple(make_graph(c(1, 2, 2, 1)))
#' which_multiple(make_graph(c(1, 2, 2, 1), dir = FALSE))
#'
#' # Remove multiple edges but keep multiplicity
#' g <- barabasi.game(10, m = 3, algorithm = "bag")
#' g <- sample_pa(10, m = 3, algorithm = "bag")
#' E(g)$weight <- count_multiple(g)
#' g <- simplify(g, edge.attr.comb = list(weight = "min"))
#' any(which_multiple(g))
Expand Down
2 changes: 1 addition & 1 deletion R/topology.R
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ graph.subisomorphic.lad <- function(pattern, target, domains = NULL,
#' isomorphic(g1, g2)
#'
#' # create two isomorphic graphs, by permuting the vertices of the first
#' g1 <- barabasi.game(30, m = 2, directed = FALSE)
#' g1 <- sample_pa(30, m = 2, directed = FALSE)
#' g2 <- permute(g1, sample(vcount(g1)))
#' # should be TRUE
#' isomorphic(g1, g2)
Expand Down
2 changes: 1 addition & 1 deletion man/cluster_fluid_communities.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/count_motifs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/each_edge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/edge_connectivity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fit_power_law.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/isomorphic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/match_vertices.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/min_separators.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/motifs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/sample_motifs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/topo_sort.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/vertex_connectivity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/which_multiple.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 0 additions & 40 deletions tests/testthat/_snaps/plot/basic-graph-r-4-2.svg

This file was deleted.

Loading