Skip to content

Commit f0f3079

Browse files
committed
feat: add new types related to attribute handling from the 'develop' branch
1 parent dd94864 commit f0f3079

File tree

4 files changed

+61
-7
lines changed

4 files changed

+61
-7
lines changed

src/codegen/internal_lib.py.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ from .errors import handle_igraph_error_t
99
from .types import (
1010
FILE,
1111
igraph_attribute_combination_t,
12+
igraph_attribute_record_list_t,
1213
igraph_attribute_table_t,
1314
igraph_bool_t,
1415
igraph_integer_t,
@@ -39,6 +40,7 @@ from .types import (
3940
igraph_maxflow_stats_t,
4041
igraph_interruption_handler_t,
4142
igraph_isocompat_t,
43+
igraph_isohandler_t,
4244
igraph_plfit_result_t,
4345
igraph_rng_t,
4446
igraph_rng_type_t,

src/igraph_ctypes/_internal/functions.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6534,7 +6534,7 @@ def subisomorphic(graph1: Graph, graph2: Graph) -> bool:
65346534

65356535
# igraph_subisomorphic_vf2: no Python type known for type: ISOCOMPAT_FUNC
65366536

6537-
# igraph_subisomorphic_function_vf2: no Python type known for type: ISOMORPHISM_FUNC
6537+
# igraph_get_subisomorphisms_vf2_callback: no Python type known for type: ISOMORPHISM_FUNC
65386538

65396539
# igraph_count_subisomorphisms_vf2: no Python type known for type: ISOCOMPAT_FUNC
65406540

@@ -6561,7 +6561,7 @@ def permute_vertices(graph: Graph, permutation: Iterable[int]) -> Graph:
65616561

65626562
# igraph_isomorphic_bliss: no Python type known for type: BLISSSH
65636563

6564-
# igraph_automorphisms: no Python type known for type: BLISSSH
6564+
# igraph_count_automorphisms: no Python type known for type: BLISSSH
65656565

65666566
# igraph_automorphism_group: no Python type known for type: BLISSSH
65676567

@@ -7226,3 +7226,9 @@ def version() -> tuple[str, int, int, int]:
72267226

72277227
# Construct return value
72287228
return version_string, major, minor, subminor
7229+
7230+
7231+
def subisomorphic_function_vf2() -> None:
7232+
"""Type-annotated wrapper for ``igraph_subisomorphic_function_vf2``."""
7233+
# Call wrapped function
7234+
igraph_subisomorphic_function_vf2()

src/igraph_ctypes/_internal/lib.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .types import (
1010
FILE,
1111
igraph_attribute_combination_t,
12+
igraph_attribute_record_list_t,
1213
igraph_attribute_table_t,
1314
igraph_bool_t,
1415
igraph_integer_t,
@@ -39,6 +40,7 @@
3940
igraph_maxflow_stats_t,
4041
igraph_interruption_handler_t,
4142
igraph_isocompat_t,
43+
igraph_isohandler_t,
4244
igraph_plfit_result_t,
4345
igraph_rng_t,
4446
igraph_rng_type_t,
@@ -633,11 +635,11 @@ def _load_libc():
633635

634636
igraph_add_edges = _lib.igraph_add_edges
635637
igraph_add_edges.restype = handle_igraph_error_t
636-
igraph_add_edges.argtypes = [POINTER(igraph_t), POINTER(igraph_vector_int_t), c_void_p]
638+
igraph_add_edges.argtypes = [POINTER(igraph_t), POINTER(igraph_vector_int_t), POINTER(igraph_attribute_record_list_t)]
637639

638640
igraph_add_vertices = _lib.igraph_add_vertices
639641
igraph_add_vertices.restype = handle_igraph_error_t
640-
igraph_add_vertices.argtypes = [POINTER(igraph_t), igraph_integer_t, c_void_p]
642+
igraph_add_vertices.argtypes = [POINTER(igraph_t), igraph_integer_t, POINTER(igraph_attribute_record_list_t)]
641643

642644
igraph_copy = _lib.igraph_copy
643645
igraph_copy.restype = handle_igraph_error_t
@@ -2195,6 +2197,10 @@ def _load_libc():
21952197
igraph_subisomorphic_vf2.restype = handle_igraph_error_t
21962198
igraph_subisomorphic_vf2.argtypes = [POINTER(igraph_t), POINTER(igraph_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_bool_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), igraph_isocompat_t, igraph_isocompat_t, c_void_p]
21972199

2200+
igraph_get_subisomorphisms_vf2_callback = _lib.igraph_get_subisomorphisms_vf2_callback
2201+
igraph_get_subisomorphisms_vf2_callback.restype = handle_igraph_error_t
2202+
igraph_get_subisomorphisms_vf2_callback.argtypes = [POINTER(igraph_t), POINTER(igraph_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), igraph_isohandler_t, igraph_isocompat_t, igraph_isocompat_t, c_void_p]
2203+
21982204
igraph_count_subisomorphisms_vf2 = _lib.igraph_count_subisomorphisms_vf2
21992205
igraph_count_subisomorphisms_vf2.restype = handle_igraph_error_t
22002206
igraph_count_subisomorphisms_vf2.argtypes = [POINTER(igraph_t), POINTER(igraph_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_integer_t), igraph_isocompat_t, igraph_isocompat_t, c_void_p]
@@ -2215,9 +2221,9 @@ def _load_libc():
22152221
igraph_isomorphic_bliss.restype = handle_igraph_error_t
22162222
igraph_isomorphic_bliss.argtypes = [POINTER(igraph_t), POINTER(igraph_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_bool_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), igraph_bliss_sh_t, POINTER(igraph_bliss_info_t), POINTER(igraph_bliss_info_t)]
22172223

2218-
igraph_automorphisms = _lib.igraph_automorphisms
2219-
igraph_automorphisms.restype = handle_igraph_error_t
2220-
igraph_automorphisms.argtypes = [POINTER(igraph_t), POINTER(igraph_vector_int_t), igraph_bliss_sh_t, POINTER(igraph_bliss_info_t)]
2224+
igraph_count_automorphisms = _lib.igraph_count_automorphisms
2225+
igraph_count_automorphisms.restype = handle_igraph_error_t
2226+
igraph_count_automorphisms.argtypes = [POINTER(igraph_t), POINTER(igraph_vector_int_t), igraph_bliss_sh_t, POINTER(igraph_bliss_info_t)]
22212227

22222228
igraph_automorphism_group = _lib.igraph_automorphism_group
22232229
igraph_automorphism_group.restype = handle_igraph_error_t

src/igraph_ctypes/_internal/types.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,40 @@ class igraph_attribute_combination_record_t(Structure):
282282
_fields_ = [("name", c_char_p), ("type", c_int), ("func", CFUNCTYPE(c_void_p))]
283283

284284

285+
class _igraph_attribute_record_value_t(CUnion):
286+
_fields_ = [
287+
("as_raw", c_void_p),
288+
("as_vector", POINTER(igraph_vector_t)),
289+
("as_strvector", POINTER(igraph_strvector_t)),
290+
("as_vector_bool", POINTER(igraph_vector_bool_t)),
291+
]
292+
293+
294+
class _igraph_attribute_record_default_value_t(CUnion):
295+
_fields_ = [
296+
("numeric", igraph_real_t),
297+
("boolean", igraph_bool_t),
298+
("string", c_char_p),
299+
]
300+
301+
302+
class igraph_attribute_record_t(Structure):
303+
"""ctypes representation of ``igraph_attribute_record_t``"""
304+
305+
_fields_ = [
306+
("name", c_char_p),
307+
("type", c_int),
308+
("value", _igraph_attribute_record_value_t),
309+
("default_value", _igraph_attribute_record_default_value_t),
310+
]
311+
312+
313+
class igraph_attribute_record_list_t(Structure):
314+
"""ctypes representation of ``igraph_attribute_record_list_t``"""
315+
316+
_fields_ = vector_fields(igraph_attribute_record_t)
317+
318+
285319
class igraph_bliss_info_t(Structure):
286320
"""ctypes representation of an ``igraph_bliss_info_t`` object"""
287321

@@ -431,6 +465,12 @@ class igraph_rng_t(Structure):
431465
igraph_integer_t,
432466
c_void_p,
433467
)
468+
igraph_isohandler_t = CFUNCTYPE(
469+
igraph_error_t,
470+
POINTER(igraph_vector_int_t),
471+
POINTER(igraph_vector_int_t),
472+
c_void_p,
473+
)
434474
igraph_warning_handler_t = CFUNCTYPE(None, c_char_p, c_char_p, c_int)
435475

436476

0 commit comments

Comments
 (0)