Skip to content

Commit

Permalink
Merge pull request #93 from stocnet/develop
Browse files Browse the repository at this point in the history
v1.2.2
  • Loading branch information
jhollway authored Oct 5, 2024
2 parents 6d6a8dd + 242179c commit 1cd2c88
Show file tree
Hide file tree
Showing 34 changed files with 1,461 additions and 963 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: manynet
Title: Many Ways to Make, Modify, Map, Mark, and Measure Myriad Networks
Version: 1.2.1
Date: 2024-10-01
Version: 1.2.2
Date: 2024-10-04
Description: Many tools for making, modifying, mapping, marking, measuring,
and motifs and memberships of many different types of networks.
All functions operate with matrices, edge lists, and 'igraph', 'network', and 'tidygraph' objects,
Expand Down
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ export(node_is_recovered)
export(node_kernighanlin)
export(node_leading_eigen)
export(node_leiden)
export(node_leverage)
export(node_louvain)
export(node_mode)
export(node_multidegree)
Expand All @@ -616,6 +617,7 @@ export(node_regular_equivalence)
export(node_richness)
export(node_roulette)
export(node_spinglass)
export(node_stress)
export(node_strong_components)
export(node_structural_equivalence)
export(node_thresholds)
Expand Down Expand Up @@ -712,6 +714,7 @@ export(to_blocks)
export(to_components)
export(to_correlation)
export(to_directed)
export(to_dominating)
export(to_ego)
export(to_egos)
export(to_eulerian)
Expand Down Expand Up @@ -835,7 +838,6 @@ importFrom(igraph,delete_vertex_attr)
importFrom(igraph,delete_vertices)
importFrom(igraph,diameter)
importFrom(igraph,distances)
importFrom(igraph,eccentricity)
importFrom(igraph,edge_attr)
importFrom(igraph,edge_attr_names)
importFrom(igraph,edge_betweenness)
Expand Down
24 changes: 24 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# manynet 1.2.2

## Package

- Updated all tutorials with different themes to make them more distinctive
- Updated centrality tutorial with gifs
- Updated visualisation tutorial with a few extras

## Modifying

- Added `to_dominating()` for extracting the dominating tree of a given network

## Mapping

- Reworked `graphr()` to make function more concise and consistent (thanks @henriquesposito)
- This allows new functionality and improves debugging moving forward

## Measuring

- Updated closeness centrality documentation
- Improved `node_eccentricity()` to allow normalisation, appear in closeness documentation
- Added `node_stress()` as a new betweenness-like centrality measure
- Added `node_leverage()` as a new degree-like centrality measure

# manynet 1.2.1

## Making
Expand Down
15 changes: 14 additions & 1 deletion R/manip_reformed.R
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ to_blocks.tbl_graph <- function(.data, membership, FUN = mean){
#' - `to_eulerian()` returns only the Eulerian path within some network data.
#' - `to_tree()` returns the spanning tree in some network data or,
#' if the data is unconnected, a forest of spanning trees.
#' - `to_dominating()` returns the dominating tree of the network
#' @details
#' Not all functions have methods available for all object classes.
#' Below are the currently implemented S3 methods:
Expand Down Expand Up @@ -651,5 +652,17 @@ to_eulerian.tbl_graph <- function(.data){
#' @export
to_tree <- function(.data) {
.data <- as_igraph(.data)
igraph::subgraph.edges(.data, igraph::sample_spanning_tree(.data))
out <- igraph::subgraph.edges(.data, igraph::sample_spanning_tree(.data))
as_tidygraph(out)
}

#' @rdname manip_paths
#' @param from The index or name of the node from which the path should be traced.
#' @param direction String, either "out" or "in".
#' @export
to_dominating <- function(.data, from, direction = c("out","in")) {
direction <- match.arg(direction)
.data <- as_igraph(.data)
out <- igraph::dominator_tree(.data, root = from, mode = direction)$domtree
as_tidygraph(out)
}
890 changes: 423 additions & 467 deletions R/map_autograph.R

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions R/mark_ties.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ tie_is_bridge <- function(.data){
}

#' @rdname mark_ties
#' @param from The index or name of the node from which the path should be traced.
#' @inheritParams manip_paths
#' @param to The index or name of the node to which the path should be traced.
#' @param all_paths Whether to return a list of paths or sample just one.
#' By default FALSE, sampling just a single path.
#' @importFrom igraph all_shortest_paths
#' @examples
#' ison_adolescents %>% mutate_ties(route = tie_is_path(from = "Jane", to = 7)) %>%
#' graphr(edge_colour = "route")
#' ison_adolescents %>%
#' mutate_ties(route = tie_is_path(from = "Jane", to = 7)) %>%
#' graphr(edge_colour = "route")
#' @export
tie_is_path <- function(.data, from, to, all_paths = FALSE){
if(missing(.data)) {expect_edges(); .data <- .G()}
Expand Down
Loading

0 comments on commit 1cd2c88

Please sign in to comment.