Skip to content

Commit

Permalink
i #229 add stop condition for weight cum pairwise
Browse files Browse the repository at this point in the history
The stop condition was not accounting for the pairwise
weight for all_lag. This includes adds the check.

Signed-off-by: Carlos Paradis <carlosviansi@gmail.com>
  • Loading branch information
carlosparadis committed Mar 3, 2024
1 parent 4516474 commit 254bc1e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions R/graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ model_directed_graph <- function(edgelist,is_bipartite,color,aggregate_duplicate
bipartite_graph_projection <- function(graph,mode,weight_scheme_function = NULL){

# If weight scheme is cum_temporal, then lag must be "all_lag":
if(identical(weight_scheme_function,kaiaulu::weight_scheme_cum_temporal)){
if((identical(weight_scheme_function,kaiaulu::weight_scheme_cum_temporal) |
identical(weight_scheme_function,kaiaulu::weight_scheme_pairwise_cum_temporal))){
stop("The weight scheme for cumulative temporal should only be applied to the temporal_graph_projection
and lag = all_lag. See ?weight_scheme_cum_temporal.")
and lag = all_lag. See ?weight_scheme_cum_temporal or ?weight_scheme_pairwise_cum_temporal.")

Check warning on line 158 in R/graph.R

View check run for this annotation

Codecov / codecov/patch

R/graph.R#L155-L158

Added lines #L155 - L158 were not covered by tests
}

get_combinations <- function(edgelist){
Expand Down Expand Up @@ -272,9 +273,11 @@ temporal_graph_projection <- function(graph,mode,weight_scheme_function = NULL,t


# If weight scheme is cum_temporal, then lag must be "all_lag":
if(identical(weight_scheme_function,kaiaulu::weight_scheme_cum_temporal) &
lag != "all_lag"){
stop("The weight scheme for cumulative temporal should only be applied to all_lag. See ?weight_scheme_cum_temporal.")
if((identical(weight_scheme_function,kaiaulu::weight_scheme_cum_temporal) |
identical(weight_scheme_function,kaiaulu::weight_scheme_pairwise_cum_temporal)
) & lag != "all_lag"){
stop("The weight scheme for cumulative temporal should only be applied to all_lag.
See ?weight_scheme_cum_temporal or ?weight_scheme_pairwise_cum_temporal.")

Check warning on line 280 in R/graph.R

View check run for this annotation

Codecov / codecov/patch

R/graph.R#L279-L280

Added lines #L279 - L280 were not covered by tests
}

# We define the way the pair-wise edges are computed in two
Expand Down

0 comments on commit 254bc1e

Please sign in to comment.