Skip to content

Commit d485e2f

Browse files
committed
vendor: Update vendored sources to igraph/igraph@01db8e2
fix: `igraph_bipartite_projection_size()` now validates the bipartite `types` vector
1 parent 356b9b8 commit d485e2f

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/vendor/cigraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
- `igraph_centralization_degree_tmax()`, `igraph_centralization_betweenness_tmax()`, `igraph_centralization_closeness_tmax()`, and `igraph_centralization_eigenvector_centrality_tmax()` now return NaN for zero-vertex graphs. Previously they would return invalid values.
3838
- `igraph_centralization_eigenvector_centrality_tmax()` now returns 0 for the undirected singleton graph. Previous it would return an invalid value.
3939
- `igraph_motifs_randesu_estimate()` now validates the sample size.
40+
- `igraph_bipartite_projection_size()` now validates the bipartite `types` vector.
4041

4142
### Deprecated
4243

src/vendor/cigraph/src/misc/bipartite.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,23 @@ igraph_error_t igraph_bipartite_projection_size(const igraph_t *graph,
9696
igraph_integer_t *vcount2,
9797
igraph_integer_t *ecount2) {
9898

99-
igraph_integer_t no_of_nodes = igraph_vcount(graph);
99+
const igraph_integer_t no_of_nodes = igraph_vcount(graph);
100100
igraph_integer_t vc1 = 0, ec1 = 0, vc2 = 0, ec2 = 0;
101101
igraph_adjlist_t adjlist;
102102
igraph_vector_int_t added;
103-
igraph_integer_t i;
103+
104+
if (igraph_vector_bool_size(types) != no_of_nodes) {
105+
IGRAPH_ERROR("Invalid bipartite type vector length.", IGRAPH_EINVAL);
106+
}
104107

105108
IGRAPH_VECTOR_INT_INIT_FINALLY(&added, no_of_nodes);
106109

107110
IGRAPH_CHECK(igraph_adjlist_init(graph, &adjlist, IGRAPH_ALL, IGRAPH_LOOPS_TWICE, IGRAPH_MULTIPLE));
108111
IGRAPH_FINALLY(igraph_adjlist_destroy, &adjlist);
109112

110-
for (i = 0; i < no_of_nodes; i++) {
113+
for (igraph_integer_t i = 0; i < no_of_nodes; i++) {
111114
igraph_vector_int_t *neis1;
112-
igraph_integer_t neilen1, j;
115+
igraph_integer_t neilen1;
113116
igraph_integer_t *ecptr;
114117
if (VECTOR(*types)[i]) {
115118
vc2++;
@@ -120,15 +123,15 @@ igraph_error_t igraph_bipartite_projection_size(const igraph_t *graph,
120123
}
121124
neis1 = igraph_adjlist_get(&adjlist, i);
122125
neilen1 = igraph_vector_int_size(neis1);
123-
for (j = 0; j < neilen1; j++) {
124-
igraph_integer_t k, neilen2, nei = VECTOR(*neis1)[j];
126+
for (igraph_integer_t j = 0; j < neilen1; j++) {
127+
igraph_integer_t neilen2, nei = VECTOR(*neis1)[j];
125128
igraph_vector_int_t *neis2 = igraph_adjlist_get(&adjlist, nei);
126129
if (IGRAPH_UNLIKELY(VECTOR(*types)[i] == VECTOR(*types)[nei])) {
127130
IGRAPH_ERROR("Non-bipartite edge found in bipartite projection.",
128131
IGRAPH_EINVAL);
129132
}
130133
neilen2 = igraph_vector_int_size(neis2);
131-
for (k = 0; k < neilen2; k++) {
134+
for (igraph_integer_t k = 0; k < neilen2; k++) {
132135
igraph_integer_t nei2 = VECTOR(*neis2)[k];
133136
if (nei2 <= i) {
134137
continue;

src/vendor/igraph_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828

2929
__BEGIN_DECLS
3030

31-
#define IGRAPH_VERSION "0.10.13-135-g7284ee015"
31+
#define IGRAPH_VERSION "0.10.13-136-g01db8e25a"
3232
#define IGRAPH_VERSION_MAJOR 0
3333
#define IGRAPH_VERSION_MINOR 10
3434
#define IGRAPH_VERSION_PATCH 13
35-
#define IGRAPH_VERSION_PRERELEASE "135-g7284ee015"
35+
#define IGRAPH_VERSION_PRERELEASE "136-g01db8e25a"
3636

3737
IGRAPH_EXPORT void igraph_version(const char **version_string,
3838
int *major,

0 commit comments

Comments
 (0)