Skip to content

Commit c442be2

Browse files
committed
chore: Update vendored sources to igraph/igraph@857a125
1 parent a8ec4aa commit c442be2

Some content is hidden

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

52 files changed

+1503
-859
lines changed

R/aaa-auto.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,6 +2835,18 @@ list_triangles_impl <- function(graph) {
28352835
res
28362836
}
28372837

2838+
join_impl <- function(left, right) {
2839+
# Argument checks
2840+
ensure_igraph(left)
2841+
ensure_igraph(right)
2842+
2843+
on.exit( .Call(R_igraph_finalizer) )
2844+
# Function call
2845+
res <- .Call(R_igraph_join, left, right)
2846+
2847+
res
2848+
}
2849+
28382850
induced_subgraph_map_impl <- function(graph, vids, impl) {
28392851
# Argument checks
28402852
ensure_igraph(graph)
@@ -3744,6 +3756,17 @@ tree_from_parent_vector_impl <- function(parents, type=c("out", "in", "undirecte
37443756
res
37453757
}
37463758

3759+
is_complete_impl <- function(graph) {
3760+
# Argument checks
3761+
ensure_igraph(graph)
3762+
3763+
on.exit( .Call(R_igraph_finalizer) )
3764+
# Function call
3765+
res <- .Call(R_igraph_is_complete, graph)
3766+
3767+
res
3768+
}
3769+
37473770
random_spanning_tree_impl <- function(graph, vid=0) {
37483771
# Argument checks
37493772
ensure_igraph(graph)

src/cpp11.cpp

Lines changed: 460 additions & 456 deletions
Large diffs are not rendered by default.

src/rinterface.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8797,6 +8797,34 @@ SEXP R_igraph_list_triangles(SEXP graph) {
87978797
return(r_result);
87988798
}
87998799

8800+
/*-------------------------------------------/
8801+
/ igraph_join /
8802+
/-------------------------------------------*/
8803+
SEXP R_igraph_join(SEXP left, SEXP right) {
8804+
/* Declarations */
8805+
igraph_t c_res;
8806+
igraph_t c_left;
8807+
igraph_t c_right;
8808+
SEXP res;
8809+
8810+
SEXP r_result;
8811+
/* Convert input */
8812+
R_SEXP_to_igraph(left, &c_left);
8813+
R_SEXP_to_igraph(right, &c_right);
8814+
/* Call igraph */
8815+
IGRAPH_R_CHECK(igraph_join(&c_res, &c_left, &c_right));
8816+
8817+
/* Convert output */
8818+
IGRAPH_FINALLY(igraph_destroy, &c_res);
8819+
PROTECT(res=R_igraph_to_SEXP(&c_res));
8820+
IGRAPH_I_DESTROY(&c_res);
8821+
IGRAPH_FINALLY_CLEAN(1);
8822+
r_result = res;
8823+
8824+
UNPROTECT(1);
8825+
return(r_result);
8826+
}
8827+
88008828
/*-------------------------------------------/
88018829
/ igraph_induced_subgraph_map /
88028830
/-------------------------------------------*/
@@ -11119,6 +11147,30 @@ SEXP R_igraph_tree_from_parent_vector(SEXP parents, SEXP type) {
1111911147
return(r_result);
1112011148
}
1112111149

11150+
/*-------------------------------------------/
11151+
/ igraph_is_complete /
11152+
/-------------------------------------------*/
11153+
SEXP R_igraph_is_complete(SEXP graph) {
11154+
/* Declarations */
11155+
igraph_t c_graph;
11156+
igraph_bool_t c_res;
11157+
SEXP res;
11158+
11159+
SEXP r_result;
11160+
/* Convert input */
11161+
R_SEXP_to_igraph(graph, &c_graph);
11162+
/* Call igraph */
11163+
IGRAPH_R_CHECK(igraph_is_complete(&c_graph, &c_res));
11164+
11165+
/* Convert output */
11166+
PROTECT(res=NEW_LOGICAL(1));
11167+
LOGICAL(res)[0]=c_res;
11168+
r_result = res;
11169+
11170+
UNPROTECT(1);
11171+
return(r_result);
11172+
}
11173+
1112211174
/*-------------------------------------------/
1112311175
/ igraph_random_spanning_tree /
1112411176
/-------------------------------------------*/

src/sources.mk

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/vendor/cigraph/.all-contributorsrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,24 @@
540540
"contributions": [
541541
"code"
542542
]
543+
},
544+
{
545+
"login": "aagon",
546+
"name": "aagon",
547+
"avatar_url": "https://avatars.githubusercontent.com/u/10883752?v=4",
548+
"profile": "https://github.com/aagon",
549+
"contributions": [
550+
"code"
551+
]
552+
},
553+
{
554+
"login": "GanzuraTheConsumer",
555+
"name": "Quinn Buratynski",
556+
"avatar_url": "https://avatars.githubusercontent.com/u/19657136?v=4",
557+
"profile": "https://github.com/GanzuraTheConsumer",
558+
"contributions": [
559+
"code"
560+
]
543561
}
544562
],
545563
"contributorsPerLine": 7

src/vendor/cigraph/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,28 @@
22

33
## [master]
44

5+
### Added
6+
7+
- `igraph_is_complete()` checks there is a connection between all pairs of vertices (experimental function, contributed by Aymeric Agon-Rambosson @aagon in #2510).
8+
59
### Fixed
610

711
- Fixed a corruption of the "finally" stack in `igraph_write_graph_gml()` for certain invalid GML files.
812
- Fixed a memory leak in `igraph_write_graph_lgl()` when vertex names were present but edge weights were not.
913
- Fixed the handling of duplicate edge IDs in `igraph_subgraph_from_edges()`.
1014
- Fixed conversion of sparse matrices to dense with `igraph_sparsemat_as_matrix()` when sparse matrix object did not make use of its full allocated capacity.
15+
- `igraph_write_graph_ncol()` and `igraph_write_graph_lgl()` now refuse to write vertex names which would result in an invalid file that cannot be read back in.
16+
- `igraph_write_graph_gml()` now ignores graph attributes called `edge` or `node` with a warning. Writing these would create an invalid GML file that igraph couldn't read back.
17+
- `igraph_disjoint_union()` and `igraph_disjoint_union_many()` now check for overflow.
18+
- `igraph_read_graph_graphml()` now correctly compares attribute values with certain expected values, meaning that prefixes of valid values of `attr.type` are not accepted any more.
19+
- Empty IDs are not allowed any more in `<key>` tags of GraphML files as this is a violation of the GraphML specification.
20+
- `igraph_is_separator()` and `igraph_is_minimal_separator()` now work correctly with disconnected graphs.
21+
- `igraph_linegraph()` now considers self-loops to be self-adjacent in undirected graphs, bringing consistency with how directed graphs were already handled in previous versions.
1122

1223
### Other
1324

25+
- Performance: `igraph_degree()` now makes use of the cache when checking for self-loops.
26+
- The performance of `igraph_is_minimal_separator()` was improved.
1427
- Documentation improvements.
1528

1629
## [0.10.10] - 2024-02-13

src/vendor/cigraph/CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ to convince the project's developers of the merits of this feature.
9696
<a name="pull-requests"></a>
9797
## Pull requests
9898

99+
_**Note:** The wiki has a lot of useful information for newcomers, as well as a
100+
[quick start guide](https://github.com/igraph/igraph/wiki/Quickstart-for-new-contributors)!_
101+
99102
Good pull requests - patches, improvements, new features - are a fantastic help.
100103
They should remain focused in scope and avoid containing unrelated commits.
101104
Please also take a look at our [tips on writing igraph code](#tips) before

src/vendor/cigraph/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
8282
<td align="center"><a href="https://github.com/larah19"><img src="https://avatars.githubusercontent.com/u/54937363?v=4?s=100" width="100px;" alt=""/><br /><sub><b>larah19</b></sub></a><br /><a href="https://github.com/igraph/igraph/commits?author=larah19" title="Code">💻</a></td>
8383
<td align="center"><a href="https://github.com/Biswa96"><img src="https://avatars.githubusercontent.com/u/31443074?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Biswapriyo Nath</b></sub></a><br /><a href="https://github.com/igraph/igraph/commits?author=Biswa96" title="Code">💻</a></td>
8484
<td align="center"><a href="http://cecinestpasunefromage.wordpress.com/"><img src="https://avatars.githubusercontent.com/u/2363820?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gwyn Ciesla</b></sub></a><br /><a href="https://github.com/igraph/igraph/commits?author=limburgher" title="Code">💻</a></td>
85+
<td align="center"><a href="https://github.com/aagon"><img src="https://avatars.githubusercontent.com/u/10883752?v=4?s=100" width="100px;" alt=""/><br /><sub><b>aagon</b></sub></a><br /><a href="https://github.com/igraph/igraph/commits?author=aagon" title="Code">💻</a></td>
86+
<td align="center"><a href="https://github.com/GanzuraTheConsumer"><img src="https://avatars.githubusercontent.com/u/19657136?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Quinn Buratynski</b></sub></a><br /><a href="https://github.com/igraph/igraph/commits?author=GanzuraTheConsumer" title="Code">💻</a></td>
8587
</tr>
8688
</table>
8789

src/vendor/cigraph/CONTRIBUTORS.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ professorcode1 (@professorcode1)
5959
larah19 (@larah19)
6060
Biswapriyo Nath (@Biswa96)
6161
Gwyn Ciesla (@limburgher)
62+
aagon (@aagon)
63+
Quinn Buratynski (@GanzuraTheConsumer)
6264

6365
This project follows the [all-contributors][1] specification. Contributions of any kind welcome!
6466

src/vendor/cigraph/include/igraph_error.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,9 @@ IGRAPH_EXPORT int IGRAPH_FINALLY_STACK_SIZE(void);
794794
#define IGRAPH_CHECK_CALLBACK(expr, code) \
795795
do { \
796796
igraph_error_t igraph_i_ret = (expr); \
797-
*(code) = igraph_i_ret; \
797+
if (code) { \
798+
*(code) = igraph_i_ret; \
799+
} \
798800
if (IGRAPH_UNLIKELY(igraph_i_ret != IGRAPH_SUCCESS && igraph_i_ret != IGRAPH_STOP)) { \
799801
IGRAPH_ERROR("", igraph_i_ret); \
800802
} \

src/vendor/cigraph/include/igraph_interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ IGRAPH_EXPORT igraph_error_t igraph_is_same_graph(const igraph_t *graph1, const
7878
IGRAPH_EXPORT IGRAPH_FUNCATTR_PURE igraph_bool_t igraph_i_property_cache_get_bool(const igraph_t *graph, igraph_cached_property_t prop);
7979
IGRAPH_EXPORT IGRAPH_FUNCATTR_PURE igraph_bool_t igraph_i_property_cache_has(const igraph_t *graph, igraph_cached_property_t prop);
8080
IGRAPH_EXPORT void igraph_i_property_cache_set_bool(const igraph_t *graph, igraph_cached_property_t prop, igraph_bool_t value);
81+
IGRAPH_EXPORT void igraph_i_property_cache_set_bool_checked(const igraph_t *graph, igraph_cached_property_t prop, igraph_bool_t value);
8182
IGRAPH_EXPORT void igraph_i_property_cache_invalidate(const igraph_t *graph, igraph_cached_property_t prop);
8283
IGRAPH_EXPORT void igraph_i_property_cache_invalidate_all(const igraph_t *graph);
8384

src/vendor/cigraph/include/igraph_operators.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ IGRAPH_EXPORT igraph_error_t igraph_union(igraph_t *res, const igraph_t *left, c
4949
igraph_vector_int_t *edge_map1, igraph_vector_int_t *edge_map2);
5050
IGRAPH_EXPORT igraph_error_t igraph_union_many(igraph_t *res, const igraph_vector_ptr_t *graphs,
5151
igraph_vector_int_list_t *edgemaps);
52+
IGRAPH_EXPORT igraph_error_t igraph_join(igraph_t *res, const igraph_t *left,
53+
const igraph_t *right);
5254
IGRAPH_EXPORT igraph_error_t igraph_intersection(igraph_t *res,
5355
const igraph_t *left, const igraph_t *right,
5456
igraph_vector_int_t *edge_map1,

src/vendor/cigraph/include/igraph_structural.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ IGRAPH_EXPORT igraph_error_t igraph_is_perfect(const igraph_t *graph, igraph_boo
8585
/* Structural properties */
8686
/* -------------------------------------------------- */
8787

88+
IGRAPH_EXPORT igraph_error_t igraph_is_complete(const igraph_t *graph, igraph_bool_t *res);
8889
IGRAPH_EXPORT igraph_error_t igraph_minimum_spanning_tree(const igraph_t *graph, igraph_vector_int_t *res,
8990
const igraph_vector_t *weights);
9091
IGRAPH_EXPORT igraph_error_t igraph_minimum_spanning_tree_unweighted(const igraph_t *graph,

src/vendor/cigraph/interfaces/functions.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,6 +2002,9 @@ igraph_disjoint_union:
20022002
igraph_disjoint_union_many:
20032003
PARAMS: OUT GRAPH res, GRAPH_PTR_LIST graphs
20042004

2005+
igraph_join:
2006+
PARAMS: OUT GRAPH res, GRAPH left, GRAPH right
2007+
20052008
igraph_union:
20062009
PARAMS: |-
20072010
OUT GRAPH res, GRAPH left, GRAPH right,
@@ -2512,6 +2515,9 @@ igraph_to_prufer:
25122515
igraph_tree_from_parent_vector:
25132516
PARAMS: OUT GRAPH graph, INDEX_VECTOR parents, TREE_MODE type=OUT
25142517

2518+
igraph_is_complete:
2519+
PARAMS: GRAPH graph, OUT BOOLEAN res
2520+
25152521
igraph_minimum_spanning_tree:
25162522
PARAMS: GRAPH graph, OUT EDGE_INDICES res, EDGEWEIGHTS weights=NULL
25172523
DEPS: res ON graph, weights ON graph

src/vendor/cigraph/src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ add_library(
231231
operators/difference.c
232232
operators/disjoint_union.c
233233
operators/intersection.c
234+
operators/join.c
234235
operators/misc_internal.c
235236
operators/permute.c
236237
operators/reverse.c
@@ -258,6 +259,7 @@ add_library(
258259
paths/widest_paths.c
259260

260261
properties/basic_properties.c
262+
properties/complete.c
261263
properties/constraint.c
262264
properties/convergence_degree.c
263265
properties/dag.c

src/vendor/cigraph/src/centrality/eigenvector.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ static igraph_error_t igraph_i_eigenvector_centrality_directed(const igraph_t *g
460460
* </para><para>
461461
* In the weighted case, the eigenvector centrality of a vertex is proportional
462462
* to the weighted sum of centralities of its neighbours, i.e.
463-
* <code>c_i = sum_j w_ij c_j</code>, where <code>w_ij</code> is the weight
464-
* of the edge connecting vertices \c i and \c j. The weights of parallel edges
463+
* <code>c_j = sum_i w_ij c_i</code>, where <code>w_ij</code> is the weight
464+
* of the edge connecting vertex \c i to \c j. The weights of parallel edges
465465
* are added up.
466466
*
467467
* </para><para>

src/vendor/cigraph/src/cliques/cliques.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ static igraph_error_t igraph_i_find_k_indsets(
168168
* Patric R. J. Östergård, http://users.aalto.fi/~pat/cliquer.html
169169
*
170170
* \param graph The input graph.
171-
* \param res Pointer to a list of integer vectors, the result will be stored
172-
* here. The pointer vector will be resized if needed.
171+
* \param res Pointer to an initialized list of integer vectors. The cliques
172+
* will be stored here as vectors of vertex IDs.
173173
* \param min_size Integer specifying the minimum size of the cliques to be
174174
* returned. If negative or zero, no lower bound will be used.
175175
* \param max_size Integer specifying the maximum size of the cliques to be
@@ -280,8 +280,8 @@ igraph_error_t igraph_cliques_callback(const igraph_t *graph,
280280
* \param vertex_weights A vector of vertex weights. The current implementation
281281
* will truncate all weights to their integer parts. You may pass \c NULL
282282
* here to make each vertex have a weight of 1.
283-
* \param res Pointer to a list of integer vectors, the result will be stored
284-
* here. The pointer vector will be resized if needed.
283+
* \param res Pointer to an initialized list of integer vectors. The cliques
284+
* will be stored here as vectors of vertex IDs.
285285
* \param min_weight Integer specifying the minimum weight of the cliques to be
286286
* returned. If negative or zero, no lower bound will be used.
287287
* \param max_weight Integer specifying the maximum weight of the cliques to be
@@ -326,8 +326,8 @@ igraph_error_t igraph_weighted_cliques(const igraph_t *graph,
326326
* \param vertex_weights A vector of vertex weights. The current implementation
327327
* will truncate all weights to their integer parts. You may pass \c NULL
328328
* here to make each vertex have a weight of 1.
329-
* \param res Pointer to a list of integer vectors, the result will be stored
330-
* here. The pointer vector will be resized if needed.
329+
* \param res Pointer to an initialized list of integer vectors. The cliques
330+
* will be stored here as vectors of vertex IDs.
331331
* \return Error code.
332332
*
333333
* \sa \ref igraph_weighted_cliques(), \ref igraph_weighted_clique_number(), \ref igraph_largest_cliques()
@@ -413,8 +413,8 @@ static igraph_error_t igraph_i_maximal_or_largest_cliques_or_indsets(
413413
* 6:505--517, 1977.
414414
*
415415
* \param graph The input graph.
416-
* \param res Pointer to a list of integer vectors, the result will be stored
417-
* here. The pointer vector will be resized if needed.
416+
* \param res Pointer to an initialized list of integer vectors. The cliques
417+
* will be stored here as vectors of vertex IDs.
418418
* \param min_size Integer specifying the minimum size of the sets to be
419419
* returned. If negative or zero, no lower bound will be used.
420420
* \param max_size Integer specifying the maximum size of the sets to be
@@ -537,8 +537,8 @@ igraph_error_t igraph_independent_vertex_sets(const igraph_t *graph,
537537
* 6:505--517, 1977.
538538
*
539539
* \param graph The input graph.
540-
* \param res Pointer to a list of integer vectors, the result will be stored
541-
* here. The pointer vector will be resized if needed.
540+
* \param res Pointer to an initialized list of integer vectors. The cliques
541+
* will be stored here as vectors of vertex IDs.
542542
* \return Error code.
543543
*
544544
* \sa \ref igraph_independent_vertex_sets(), \ref
@@ -758,8 +758,8 @@ static void free_set_array(igraph_set_t *array, igraph_integer_t n) {
758758
* use \ref igraph_independence_number() instead.
759759
*
760760
* \param graph The input graph.
761-
* \param res Pointer to a list of integer vectors, the result will be stored
762-
* here. The pointer vector will be resized if needed.
761+
* \param res Pointer to an initialized list of integer vectors. The cliques
762+
* will be stored here as vectors of vertex IDs.
763763
* \return Error code.
764764
*
765765
* \sa \ref igraph_maximal_cliques(), \ref
@@ -948,8 +948,8 @@ static igraph_error_t igraph_i_largest_cliques_store(const igraph_vector_int_t*
948948
* these two versions.
949949
*
950950
* \param graph The input graph.
951-
* \param res Pointer to a list of integer vectors, the result will be stored
952-
* here. The pointer vector will be resized if needed.
951+
* \param res Pointer to an initialized list of integer vectors. The cliques
952+
* will be stored here as vectors of vertex IDs.
953953
* \return Error code.
954954
*
955955
* \sa \ref igraph_cliques(), \ref igraph_maximal_cliques()

src/vendor/cigraph/src/cliques/maximal_cliques.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,8 @@ static igraph_error_t igraph_i_maximal_cliques_up(
339339
* almost surely be different between these three versions.
340340
*
341341
* \param graph The input graph.
342-
* \param res Pointer to a pointer vector, the result will be stored
343-
* here, i.e. \p res will contain pointers to \ref igraph_vector_int_t
344-
* objects which contain the indices of vertices involved in a clique.
345-
* The pointer vector will be resized if needed but note that the
346-
* objects in the pointer vector will not be freed. Note that vertices
342+
* \param res Pointer to list of integer vectors. The maximal cliques
343+
* will be returned here as vectors of vertex IDs. Note that vertices
347344
* of a clique may be returned in arbitrary order.
348345
* \param min_size Integer giving the minimum size of the cliques to be
349346
* returned. If negative or zero, no lower bound will be used.

src/vendor/cigraph/src/community/community_misc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ static igraph_error_t igraph_i_split_join_distance(const igraph_vector_int_t *v1
341341
* <code>VI(C_1, C_2) = [H(C_1) - MI(C_1, C_2)] + [H(C_2) - MI(C_1, C_2)]</code>.
342342
* Lower values of the variation of information indicate a smaller difference between
343343
* the two clusterings, with <code>VI = 0</code> achieved precisely when they coincide.
344+
* igraph uses natural units for the variation of information, i.e. it uses the
345+
* natural logarithm when computing entropies.
344346
*
345347
* </para><para>
346348
* The Rand index is defined as the probability that the two clusterings agree

src/vendor/cigraph/src/community/fast_modularity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ igraph_error_t igraph_community_fastgreedy(const igraph_t *graph,
696696
} else {
697697
debug("Calculating degrees\n");
698698
IGRAPH_VECTOR_INT_INIT_FINALLY(&degrees, no_of_nodes);
699-
IGRAPH_CHECK(igraph_degree(graph, &degrees, igraph_vss_all(), IGRAPH_ALL, 1));
699+
IGRAPH_CHECK(igraph_degree(graph, &degrees, igraph_vss_all(), IGRAPH_ALL, true));
700700
for (i = 0; i < no_of_nodes; i++) {
701701
VECTOR(a)[i] = VECTOR(degrees)[i];
702702
}

0 commit comments

Comments
 (0)