9898 "vertexlike_to_igraph_integer_t" ,
9999 "vertex_pairs_to_igraph_vector_int_t" ,
100100 "vertex_selector_to_igraph_vs_t" ,
101+ "vertex_qty_to_igraph_vector_t" ,
102+ "vertex_qty_to_igraph_vector_t_view" ,
101103)
102104
103105
@@ -142,15 +144,15 @@ def edge_selector_to_igraph_es_t(
142144 return _EdgeSelector .create_with (igraph_es_1 , index )
143145
144146
145- def edge_weights_to_igraph_vector_t (weights : Iterable [float ]) -> _Vector :
147+ def edge_weights_to_igraph_vector_t (weights : Iterable [float ], graph : _Graph ) -> _Vector :
146148 """Converts a Python iterable of floating-point numbers to a vector of
147149 edge weights.
148150 """
149151 return iterable_to_igraph_vector_t (weights )
150152
151153
152154def edge_weights_to_igraph_vector_t_view (
153- weights : Optional [Iterable [float ]],
155+ weights : Optional [Iterable [float ]], graph : _Graph
154156) -> Optional [_Vector ]:
155157 """Converts a Python iterable of floating-point numbers to a vector of
156158 edge weights, possibly creating a shallow view if the input is an
@@ -159,7 +161,9 @@ def edge_weights_to_igraph_vector_t_view(
159161 When the input is `None`, the return value will also be `None`, which is
160162 interpreted by the C core of igraph as all edges having equal weight.
161163 """
162- return edge_weights_to_igraph_vector_t (weights ) if weights is not None else None
164+ return (
165+ edge_weights_to_igraph_vector_t (weights , graph ) if weights is not None else None
166+ )
163167
164168
165169def iterable_edge_indices_to_igraph_vector_int_t (
@@ -439,6 +443,28 @@ def vertex_selector_to_igraph_vs_t(
439443 return _VertexSelector .create_with (igraph_vs_1 , index )
440444
441445
446+ def vertex_qty_to_igraph_vector_t (weights : Iterable [float ], graph : _Graph ) -> _Vector :
447+ """Converts a Python iterable of floating-point numbers to a vector of
448+ vertex-related quantities.
449+ """
450+ return iterable_to_igraph_vector_t (weights )
451+
452+
453+ def vertex_qty_to_igraph_vector_t_view (
454+ weights : Optional [Iterable [float ]], graph : _Graph
455+ ) -> Optional [_Vector ]:
456+ """Converts a Python iterable of floating-point numbers to a vector of
457+ vertex-related quantities, possibly creating a shallow view if the input is
458+ an appropriate NumPy array.
459+
460+ When the input is `None`, the return value will also be `None`, which is
461+ interpreted by the C core of igraph as all edges having equal weight.
462+ """
463+ return (
464+ vertex_qty_to_igraph_vector_t (weights , graph ) if weights is not None else None
465+ )
466+
467+
442468################################################################################
443469# Conversion from igraph data types to Python #
444470################################################################################
0 commit comments