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

replace igraph::estimate_closeness() with igraph::closeness() because… #271

Merged
merged 23 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
486b9e4
Hotfix on create-release
jhollway May 2, 2022
a8ff094
Merge pull request #228 from snlab-ch/develop
jhollway Jun 16, 2022
3e5101e
Merge pull request #229 from snlab-ch/develop
jhollway Jun 17, 2022
6e240b1
Merge pull request #230 from snlab-ch/develop
jhollway Jun 20, 2022
7e42588
Merge pull request #238 from snlab-ch/develop
jhollway Jul 3, 2022
f5904f2
Merge pull request #239 from snlab-ch/develop
jhollway Jul 3, 2022
74ac5c5
Merge pull request #240 from snlab-ch/develop
jhollway Jul 3, 2022
3a5885e
Merge pull request #241 from snlab-ch/develop
jhollway Jul 3, 2022
92ec62b
Merge pull request #243 from snlab-ch/develop
jhollway Sep 7, 2022
20939df
Merge pull request #244 from snlab-ch/develop
jhollway Sep 10, 2022
a916526
Merge pull request #245 from snlab-ch/develop
jhollway Sep 13, 2022
decbde5
Merge pull request #246 from snlab-ch/develop
jhollway Sep 27, 2022
d3f21ea
Merge pull request #248 from snlab-ch/develop
jhollway Oct 3, 2022
780d5d9
Merge pull request #249 from snlab-ch/develop
jhollway Oct 20, 2022
1e7ccfb
Merge pull request #250 from snlab-ch/develop
jhollway Oct 25, 2022
cd61e93
Merge pull request #251 from snlab-ch/develop
jhollway Oct 26, 2022
ee47435
Merge pull request #252 from snlab-ch/develop
jhollway Nov 2, 2022
4cf10c2
Merge pull request #254 from snlab-ch/develop
jhollway Nov 9, 2022
a5a9fa5
Merge pull request #257 from snlab-ch/develop
jhollway Nov 30, 2022
052b2a2
Merge pull request #260 from snlab-ch/develop
jhollway Dec 5, 2022
e1fd98d
Merge pull request #263 from snlab-ch/develop
jhollway Dec 20, 2022
6ee6e54
Merge pull request #270 from snlab-ch/develop
jhollway Jun 14, 2023
eed5783
replace igraph::estimate_closeness() with igraph::closeness() because…
maelle Jun 16, 2023
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
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ importFrom(network,as.network)
importFrom(network,is.network)
importFrom(purrr,flatten)
importFrom(rlang,.data)
importFrom(rlang,`%||%`)
importFrom(rlang,enquo)
importFrom(rlang,eval_tidy)
importFrom(sna,brokerage)
Expand Down
18 changes: 7 additions & 11 deletions R/measure_centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ node_betweenness <- function(.data, normalized = TRUE,
directed = manynet::is_directed(graph), weights = weights,
normalized = normalized)
} else {
out <- igraph::estimate_betweenness(graph = graph, vids = igraph::V(graph),
directed = manynet::is_directed(graph),
cutoff = cutoff,
weights = weights)
out <- igraph::betweenness(graph = graph, v = igraph::V(graph),
directed = manynet::is_directed(graph),
cutoff = cutoff,
weights = weights)
}
}
out <- make_node_measure(out, .data)
Expand Down Expand Up @@ -325,13 +325,9 @@ node_closeness <- function(.data, normalized = TRUE,
set_size <- ifelse(igraph::V(graph)$type, sum(igraph::V(graph)$type), sum(!igraph::V(graph)$type))
out <- closeness/(1/(other_set_size+2*set_size-2))
} else {
if (is.null(cutoff)) {
out <- igraph::closeness(graph = graph, vids = igraph::V(graph), mode = direction,
weights = weights, normalized = normalized)
} else {
out <- igraph::estimate_closeness(graph = graph, vids = igraph::V(graph), mode = direction,
cutoff = cutoff, weights = weights, normalized = normalized)
}
cutoff <- cutoff %||% -1
out <- igraph::closeness(graph = graph, vids = igraph::V(graph), mode = direction,
cutoff = cutoff, weights = weights, normalized = normalized)
}
out <- make_node_measure(out, .data)
out
Expand Down
7 changes: 7 additions & 0 deletions R/migraph-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#' @importFrom rlang `%||%`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added here because of https://usethis.r-lib.org/reference/use_import_from.html (it could be elsewhere of course)

#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL
32 changes: 32 additions & 0 deletions man/migraph-package.Rd

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