Skip to content

Commit b5e46cb

Browse files
authored
Merge branch 'main' into fix/protect
2 parents cf92b83 + 1a307d1 commit b5e46cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+503
-374
lines changed

.github/workflows/build-and-check.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ jobs:
113113
matrix:
114114
config:
115115
- {os: windows-latest, r: 'release'}
116-
- {os: macOS-latest, r: 'release'}
116+
# - {os: macOS-latest, r: 'release'}
117117
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
118-
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
118+
# - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
119119
- {os: ubuntu-20.04, r: 'oldrel-1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
120120
- {os: ubuntu-20.04, r: 'oldrel-2', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
121121
- {os: ubuntu-20.04, r: 'oldrel-3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
@@ -164,7 +164,7 @@ jobs:
164164
- name: Install R dependencies
165165
uses: r-lib/actions/setup-r-dependencies@v2
166166
with:
167-
extra-packages: any::rcmdcheck
167+
extra-packages: any::rcmdcheck, graph=?ignore
168168
needs: check
169169

170170
- name: Check R package
@@ -205,6 +205,7 @@ jobs:
205205
uses: r-lib/actions/setup-r-dependencies@v2
206206
with:
207207
needs: coverage
208+
extra-packages: graph=?ignore
208209
pak-version: devel
209210

210211
- name: Run coverage

CITATION.cff

+24-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# -----------------------------------------------------------
2-
# CITATION file created with {cffr} R package, v1.0.0
1+
# --------------------------------------------
2+
# CITATION file created with {cffr} R package
33
# See also: https://docs.ropensci.org/cffr/
4-
# -----------------------------------------------------------
4+
# --------------------------------------------
55

66
cff-version: 1.2.0
77
message: 'To cite package "igraph" in publications use:'
@@ -254,7 +254,7 @@ references:
254254
title: ape
255255
abstract: 'ape: Analyses of Phylogenetics and Evolution'
256256
notes: Suggests
257-
url: http://ape-package.ird.fr/
257+
url: https://github.com/emmanuelparadis/ape
258258
repository: https://CRAN.R-project.org/package=ape
259259
authors:
260260
- family-names: Paradis
@@ -438,22 +438,6 @@ references:
438438
- family-names: Chirico.
439439
given-names: Michael
440440
year: '2024'
441-
- type: software
442-
title: graph
443-
abstract: 'graph: graph: A package to handle graph data structures'
444-
notes: Suggests
445-
repository: https://bioconductor.org/
446-
authors:
447-
- family-names: Gentleman
448-
given-names: R
449-
- family-names: Whalen
450-
given-names: Elizabeth
451-
- family-names: Huber
452-
given-names: W
453-
- family-names: Falcon
454-
given-names: S
455-
year: '2024'
456-
doi: 10.18129/B9.bioc.graph
457441
- type: software
458442
title: igraphdata
459443
abstract: 'igraphdata: A Collection of Network Data Sets for the ''igraph'' Package'
@@ -630,6 +614,25 @@ references:
630614
- family-names: Chang
631615
given-names: Winston
632616
year: '2024'
617+
- type: software
618+
title: graph
619+
abstract: 'graph: graph: A package to handle graph data structures'
620+
notes: Enhances
621+
repository: https://bioconductor.org/
622+
authors:
623+
- family-names: Gentleman
624+
given-names: R
625+
- family-names: Whalen
626+
given-names: Elizabeth
627+
- family-names: Huber
628+
given-names: W
629+
- family-names: Falcon
630+
given-names: S
631+
- family-names: Gentry
632+
given-names: Jeff
633+
- family-names: Shannon
634+
given-names: Paul
635+
year: '2024'
633636
- type: software
634637
title: cpp11
635638
abstract: 'cpp11: A C++11 Interface for R''s C Interface'
@@ -654,3 +657,4 @@ identifiers:
654657
value: https://igraph.org/
655658
- type: url
656659
value: https://igraph.discourse.group/
660+

DESCRIPTION

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: igraph
2-
Version: 2.0.3.9016
2+
Version: 2.0.3.9020
33
Title: Network Analysis and Visualization
44
Authors@R: c(
55
person("Gábor", "Csárdi", , "[email protected]", role = "aut",
@@ -47,7 +47,6 @@ Suggests:
4747
callr,
4848
decor,
4949
digest,
50-
graph,
5150
igraphdata,
5251
knitr,
5352
rgl,
@@ -58,6 +57,8 @@ Suggests:
5857
testthat,
5958
vdiffr,
6059
withr
60+
Enhances:
61+
graph
6162
LinkingTo:
6263
cpp11 (>= 0.4.7)
6364
VignetteBuilder:

NEWS.md

+48
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
<!-- NEWS.md is maintained by https://fledge.cynkra.com, contributors should not edit this file -->
22

3+
# igraph 2.0.3.9020
4+
5+
## Features
6+
7+
- Rename sample_degseq() method and add the edge.switching.simple method (#1376).
8+
9+
10+
# igraph 2.0.3.9019
11+
12+
## Bug fixes
13+
14+
- Fix reading of LGL and NCOL files (broken in 2.0.0) (#1347).
15+
16+
## Continuous integration
17+
18+
- Work around installation problems for the graph package (#1374).
19+
20+
## Testing
21+
22+
- Refactor test-assortativity for readability (#1371).
23+
24+
## Uncategorized
25+
26+
- Refactoring around test-attributes.R (#1372).
27+
28+
29+
# igraph 2.0.3.9018
30+
31+
## Bug fixes
32+
33+
- Fixed potential memory leak in `R_igraph_community_to_membership2()` (#1367).
34+
35+
36+
# igraph 2.0.3.9017
37+
38+
## Bug fixes
39+
40+
- Comment failing ci (#1357).
41+
42+
## Testing
43+
44+
- Refactoring around `interface.R` (#1366).
45+
46+
## Uncategorized
47+
48+
- Fix `%\>%` typo in vignettes (#1343).
49+
50+
351
# igraph 2.0.3.9016
452

553
## doc

R/foreign.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ read.graph.ncol <- function(file, predef = character(0), names = TRUE,
296296
on.exit(.Call(R_igraph_finalizer))
297297
.Call(
298298
R_igraph_read_graph_ncol, file, as.character(predef),
299-
as.logical(names), as.numeric(weights), as.logical(directed)
299+
as.logical(names), weights, as.logical(directed)
300300
)
301301
}
302302

@@ -336,7 +336,7 @@ read.graph.lgl <- function(file, names = TRUE,
336336
on.exit(.Call(R_igraph_finalizer))
337337
.Call(
338338
R_igraph_read_graph_lgl, file,
339-
as.logical(names), as.numeric(weights), as.logical(directed)
339+
as.logical(names), weights, as.logical(directed)
340340
)
341341
}
342342

R/games.R

+65-36
Original file line numberDiff line numberDiff line change
@@ -752,45 +752,56 @@ random.graph.game <- erdos.renyi.game
752752
#' It is often useful to create a graph with given vertex degrees. This function
753753
#' creates such a graph in a randomized manner.
754754
#'
755-
#' The \dQuote{simple} method connects the out-stubs of the edges (undirected
756-
#' graphs) or the out-stubs and in-stubs (directed graphs) together. This way
757-
#' loop edges and also multiple edges may be generated. This method is not
758-
#' adequate if one needs to generate simple graphs with a given degree
759-
#' sequence. The multiple and loop edges can be deleted, but then the degree
760-
#' sequence is distorted and there is nothing to ensure that the graphs are
761-
#' sampled uniformly.
762-
#'
763-
#' The \dQuote{simple.no.multiple} method is similar to \dQuote{simple}, but
764-
#' tries to avoid multiple and loop edges and restarts the generation from
765-
#' scratch if it gets stuck. It is not guaranteed to sample uniformly from the
766-
#' space of all possible graphs with the given sequence, but it is relatively
767-
#' fast and it will eventually succeed if the provided degree sequence is
768-
#' graphical, but there is no upper bound on the number of iterations.
769-
#'
770-
#' The \dQuote{simple.no.multiple.uniform} method is a variant of
771-
#' \dQuote{simple.no.multiple} with the added benefit of sampling uniformly
772-
#' from the set of all possible simple graphs with the given degree sequence.
773-
#' Ensuring uniformity has some performance implications, though.
774-
#'
775-
#' The \dQuote{vl} method is a more sophisticated generator. The algorithm and
776-
#' the implementation was done by Fabien Viger and Matthieu Latapy. This
777-
#' generator always generates undirected, connected simple graphs, it is an
778-
#' error to pass the `in.deg` argument to it. The algorithm relies on
779-
#' first creating an initial (possibly unconnected) simple undirected graph
780-
#' with the given degree sequence (if this is possible at all). Then some
781-
#' rewiring is done to make the graph connected. Finally a Monte-Carlo
782-
#' algorithm is used to randomize the graph. The \dQuote{vl} samples from the
783-
#' undirected, connected simple graphs uniformly.
755+
#' The \dQuote{configuration} method (formerly called "simple") implements the
756+
#' configuration model. For undirected graphs, it puts all vertex IDs in a bag
757+
#' such that the multiplicity of a vertex in the bag is the same as its degree.
758+
#' Then it draws pairs from the bag until the bag becomes empty. This method may
759+
#' generate both loop (self) edges and multiple edges. For directed graphs,
760+
#' the algorithm is basically the same, but two separate bags are used
761+
#' for the in- and out-degrees. Undirected graphs are generated
762+
#' with probability proportional to \eqn{(\prod_{i<j} A_{ij} ! \prod_i A_{ii} !!)^{-1}},
763+
#' where A denotes the adjacency matrix and !! denotes the double factorial.
764+
#' Here A is assumed to have twice the number of self-loops on its diagonal.
765+
#' The corresponding expression for directed graphs is \eqn{(\prod_{i,j} A_{ij}!)^{-1}}.
766+
#' Thus the probability of all simple graphs
767+
#' (which only have 0s and 1s in the adjacency matrix)
768+
#' is the same, while that of non-simple ones depends on their edge and
769+
#' self-loop multiplicities.
770+
#'
771+
#' The \dQuote{fast.heur.simple} method (formerly called "simple.no.multiple")
772+
#' generates simple graphs.
773+
#' It is similar to \dQuote{configuration} but tries to avoid multiple and
774+
#' loop edges and restarts the generation from scratch if it gets stuck.
775+
#' It can generate all simple realizations of a degree sequence,
776+
#' but it is not guaranteed to sample them uniformly.
777+
#' This method is relatively fast and it will eventually succeed
778+
#' if the provided degree sequence is graphical, but there is no upper bound on
779+
#' the number of iterations.
780+
#'
781+
#' The \dQuote{configuration.simple} method (formerly called "simple.no.multiple.uniform")
782+
#' is
783+
#' identical to \dQuote{configuration}, but if the generated graph is not simple,
784+
#' it rejects it and re-starts the generation.
785+
#' It generates all simple graphs with the same probability.
786+
#'
787+
#' The \dQuote{vl} method samples undirected connected graphs approximately uniformly.
788+
#' It is a Monte Carlo method based on degree-preserving edge switches.
789+
#' This generator should be favoured if undirected and connected graphs are to be
790+
#' generated and execution time is not a concern. igraph uses
791+
#' the original implementation of Fabien Viger; for the algorithm, see
792+
#' <https://www-complexnetworks.lip6.fr/~latapy/FV/generation.html>
793+
#' and the paper <https://arxiv.org/abs/cs/0502085>.
794+
#'
795+
#' The \dQuote{edge.switching.simple} is an MCMC sampler based on
796+
#' degree-preserving edge switches. It generates simple undirected or directed graphs.
784797
#'
785798
#' @param out.deg Numeric vector, the sequence of degrees (for undirected
786799
#' graphs) or out-degrees (for directed graphs). For undirected graphs its sum
787800
#' should be even. For directed graphs its sum should be the same as the sum of
788801
#' `in.deg`.
789802
#' @param in.deg For directed graph, the in-degree sequence. By default this is
790803
#' `NULL` and an undirected graph is created.
791-
#' @param method Character, the method for generating the graph. Right now the
792-
#' \dQuote{simple}, \dQuote{simple.no.multiple} and \dQuote{vl} methods are
793-
#' implemented.
804+
#' @param method Character, the method for generating the graph. See Details.
794805
#' @return The new graph object.
795806
#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
796807
#' @seealso
@@ -909,13 +920,31 @@ random.graph.game <- erdos.renyi.game
909920
#' all(degree(powerlaw_vl_graph) == powerlaw_degrees)
910921
#'
911922
sample_degseq <- function(out.deg, in.deg = NULL,
912-
method = c("simple", "vl", "simple.no.multiple", "simple.no.multiple.uniform")) {
923+
method = c("configuration", "vl", "fast.heur.simple", "configuration.simple", "edge.switching.simple")) {
913924
method <- igraph.match.arg(method)
925+
926+
if (method == "simple") {
927+
lifecycle::deprecate_warn("2.0.4", "sample_degseq(method = 'must be configuration instead of simple')")
928+
method <- "configuration"
929+
}
930+
931+
if (method == "simple.no.multiple") {
932+
lifecycle::deprecate_warn("2.0.4", "sample_degseq(method = 'must be fast.heur.simple instead of simple.no.multiple')")
933+
method <- "fast.heur.simple"
934+
}
935+
936+
if (method == "simple.no.multiple.uniform") {
937+
lifecycle::deprecate_warn("2.0.4", "sample_degseq(method = 'must be configuration.simple instead of simple.no.multiple.uniform')")
938+
method <- "configuration.simple"
939+
}
940+
941+
# numbers from https://github.com/igraph/igraph/blob/640083c88bf85fd322ff7b748b9b4e16ebe32aa2/include/igraph_constants.h#L94
914942
method1 <- switch(method,
915-
"simple" = 0,
943+
"configuration" = 0,
916944
"vl" = 1,
917-
"simple.no.multiple" = 2,
918-
"simple.no.multiple.uniform" = 3
945+
"fast.heur.simple" = 2,
946+
"configuration.simple" = 3,
947+
"edge.switching.simple" = 4
919948
)
920949
if (!is.null(in.deg)) {
921950
in.deg <- as.numeric(in.deg)

R/make.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
#' r2 <- make_(ring(10), with_vertex_(color = "red", name = LETTERS[1:10]))
172172
#' l2 <- make_(lattice(c(3, 3, 3)), with_edge_(weight = 2))
173173
#'
174-
#' ran <- sample_(degseq(c(3, 3, 3, 3, 3, 3), method = "simple"), simplified())
174+
#' ran <- sample_(degseq(c(3, 3, 3, 3, 3, 3), method = "configuration"), simplified())
175175
#' degree(ran)
176176
#' is_simple(ran)
177177
make_ <- function(...) {

man/degree.sequence.game.Rd

+1-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/make_.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)