Skip to content

Commit

Permalink
Closed #149 by adding extra column to node_tie_census in `cluster_str…
Browse files Browse the repository at this point in the history
…uctural_equivalence()` for isolates, note that this renders all isolates structurally equivalent
  • Loading branch information
jhollway committed Dec 18, 2021
1 parent af2df86 commit 4ba0f47
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# migraph 0.8.13

## Modelling

* Closed #149 by adding extra column to node_tie_census in `cluster_structural_equivalence()` for isolates
- Note that this renders all isolates structurally equivalent

# migraph 0.8.12

## Package
Expand Down
4 changes: 3 additions & 1 deletion R/cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ NULL
#' @export
cluster_structural_equivalence <- function(object){
mat <- node_tie_census(object)
if(any(colSums(t(mat))==0)) stop("Please remove any isolates before using this function.")
if(any(colSums(t(mat))==0)){
mat <- cbind(mat, (colSums(t(mat))==0))
}
correlations <- cor(t(mat))
dissimilarity <- 1 - correlations
distances <- stats::as.dist(dissimilarity)
Expand Down
2 changes: 1 addition & 1 deletion man/graph_census.Rd

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

0 comments on commit 4ba0f47

Please sign in to comment.