Skip to content

Commit 57690b1

Browse files
committed
feat: add EDGE_LENGTHS abstract type
1 parent 434c2a4 commit 57690b1

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/codegen/types.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@ EDGE_WEIGHTS:
207207
OUT: "%C% = _Vector.create(0)"
208208
OUTCONV: "%I% = igraph_vector_t_to_numpy_array(%C%)"
209209

210+
EDGE_LENGTHS:
211+
PY_TYPE: Iterable[float]
212+
PY_RETURN_TYPE: RealArray
213+
INCONV:
214+
IN: "%C% = edge_lengths_to_igraph_vector_t_view(%I%, %I1%)"
215+
INOUT: "%C% = edge_lengths_to_igraph_vector_t(%I%, %I1%)"
216+
OUT: "%C% = _Vector.create(0)"
217+
OUTCONV: "%I% = igraph_vector_t_to_numpy_array(%C%)"
218+
210219
EDGE_CAPACITIES:
211220
PY_TYPE: Iterable[float]
212221
PY_RETURN_TYPE: RealArray

src/igraph_ctypes/_internal/conversion.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
"edge_capacities_to_igraph_vector_t_view",
9090
"edge_colors_to_igraph_vector_t",
9191
"edge_colors_to_igraph_vector_t_view",
92+
"edge_lengths_to_igraph_vector_t",
93+
"edge_lengths_to_igraph_vector_t_view",
9294
"edge_selector_to_igraph_es_t",
9395
"edge_weights_to_igraph_vector_t",
9496
"edge_weights_to_igraph_vector_t_view",
@@ -184,6 +186,12 @@ def edge_weights_to_igraph_vector_t_view(
184186
return iterable_to_igraph_vector_t_view(weights) if weights is not None else None
185187

186188

189+
# Currently we handle lengths the same way as weights; this might change in
190+
# the future
191+
edge_lengths_to_igraph_vector_t = edge_weights_to_igraph_vector_t
192+
edge_lengths_to_igraph_vector_t_view = edge_weights_to_igraph_vector_t_view
193+
194+
187195
# Currently we handle capacities the same way as weights; this might change in
188196
# the future
189197
edge_capacities_to_igraph_vector_t = edge_weights_to_igraph_vector_t

src/igraph_ctypes/_internal/lib.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ def _load_igraph_c_library():
596596
igraph_connect_neighborhood.restype = handle_igraph_error_t
597597
igraph_connect_neighborhood.argtypes = [POINTER(igraph_t), igraph_integer_t, igraph_neimode_t]
598598

599+
igraph_graph_power = _lib.igraph_graph_power
600+
igraph_graph_power.restype = handle_igraph_error_t
601+
igraph_graph_power.argtypes = [POINTER(igraph_t), POINTER(igraph_t), igraph_integer_t, igraph_bool_t]
602+
599603
igraph_linegraph = _lib.igraph_linegraph
600604
igraph_linegraph.restype = handle_igraph_error_t
601605
igraph_linegraph.argtypes = [POINTER(igraph_t), POINTER(igraph_t)]
@@ -1588,6 +1592,10 @@ def _load_igraph_c_library():
15881592
igraph_community_infomap.restype = handle_igraph_error_t
15891593
igraph_community_infomap.argtypes = [POINTER(igraph_t), POINTER(igraph_vector_t), POINTER(igraph_vector_t), igraph_integer_t, POINTER(igraph_vector_int_t), POINTER(igraph_real_t)]
15901594

1595+
igraph_community_voronoi = _lib.igraph_community_voronoi
1596+
igraph_community_voronoi.restype = handle_igraph_error_t
1597+
igraph_community_voronoi.argtypes = [POINTER(igraph_t), POINTER(igraph_vector_int_t), POINTER(igraph_vector_int_t), POINTER(igraph_real_t), POINTER(igraph_vector_t), POINTER(igraph_vector_t), igraph_neimode_t, igraph_real_t]
1598+
15911599
igraph_graphlets = _lib.igraph_graphlets
15921600
igraph_graphlets.restype = handle_igraph_error_t
15931601
igraph_graphlets.argtypes = [POINTER(igraph_t), POINTER(igraph_vector_t), POINTER(igraph_vector_int_list_t), POINTER(igraph_vector_t), igraph_integer_t]

0 commit comments

Comments
 (0)