88from .enums import * # noqa
99from .lib import * # noqa
1010from .types import (
11+ AttributeCombinationSpecification ,
1112 BoolArray ,
1213 EdgeLike ,
1314 EdgeSelector ,
@@ -2391,7 +2392,17 @@ def path_length_hist(graph: Graph, directed: bool = True) -> tuple[RealArray, fl
23912392 # Construct return value
23922393 return res , unconnected
23932394
2394- # igraph_simplify: no Python type known for type: EDGE_ATTRIBUTE_COMBINATION
2395+
2396+ def simplify (graph : Graph , remove_multiple : bool = True , remove_loops : bool = True , edge_attr_comb : Optional [AttributeCombinationSpecification ] = None ) -> None :
2397+ """Type-annotated wrapper for ``igraph_simplify``."""
2398+ # Prepare input arguments
2399+ c_graph = graph
2400+ c_remove_multiple = any_to_igraph_bool_t (remove_multiple )
2401+ c_remove_loops = any_to_igraph_bool_t (remove_loops )
2402+ c_edge_attr_comb = mapping_to_attribute_combination_t (edge_attr_comb )
2403+
2404+ # Call wrapped function
2405+ igraph_simplify (c_graph , c_remove_multiple , c_remove_loops , c_edge_attr_comb )
23952406
23962407
23972408def transitivity_undirected (graph : Graph , mode : TransitivityMode = TransitivityMode .NAN ) -> float :
@@ -3167,7 +3178,16 @@ def assortativity_degree(graph: Graph, directed: bool = True) -> float:
31673178 # Construct return value
31683179 return res
31693180
3170- # igraph_contract_vertices: no Python type known for type: VERTEX_ATTRIBUTE_COMBINATION
3181+
3182+ def contract_vertices (graph : Graph , mapping : Iterable [int ], vertex_attr_comb : Optional [AttributeCombinationSpecification ] = None ) -> None :
3183+ """Type-annotated wrapper for ``igraph_contract_vertices``."""
3184+ # Prepare input arguments
3185+ c_graph = graph
3186+ c_mapping = iterable_to_igraph_vector_int_t_view (mapping )
3187+ c_vertex_attr_comb = mapping_to_attribute_combination_t (vertex_attr_comb )
3188+
3189+ # Call wrapped function
3190+ igraph_contract_vertices (c_graph , c_mapping , c_vertex_attr_comb )
31713191
31723192
31733193def eccentricity (graph : Graph , vids : VertexSelector = "all" , mode : NeighborMode = NeighborMode .ALL ) -> RealArray :
@@ -3837,6 +3857,9 @@ def maximal_cliques_subset(graph: Graph, subset: Iterable[VertexLike], outfile:
38373857 # Construct return value
38383858 return res , no
38393859
3860+ # Help the type checker to figure out that we never get here
3861+ assert False , "unreachable" # noqa: B011
3862+
38403863# igraph_maximal_cliques_callback: no Python type known for type: CLIQUE_FUNC
38413864
38423865
@@ -4961,9 +4984,26 @@ def get_stochastic(graph: Graph, column_wise: bool = False, weights: Optional[It
49614984
49624985# igraph_get_stochastic_sparse: no Python type known for type: SPARSEMAT
49634986
4964- # igraph_to_directed: no Python type known for type: TODIRECTED
49654987
4966- # igraph_to_undirected: no Python type known for type: TOUNDIRECTED
4988+ def to_directed (graph : Graph , mode : ToDirected = ToDirected .MUTUAL ) -> None :
4989+ """Type-annotated wrapper for ``igraph_to_directed``."""
4990+ # Prepare input arguments
4991+ c_graph = graph
4992+ c_mode = c_int (mode )
4993+
4994+ # Call wrapped function
4995+ igraph_to_directed (c_graph , c_mode )
4996+
4997+
4998+ def to_undirected (graph : Graph , mode : ToUndirected = ToUndirected .COLLAPSE , edge_attr_comb : Optional [AttributeCombinationSpecification ] = None ) -> None :
4999+ """Type-annotated wrapper for ``igraph_to_undirected``."""
5000+ # Prepare input arguments
5001+ c_graph = graph
5002+ c_mode = c_int (mode )
5003+ c_edge_attr_comb = mapping_to_attribute_combination_t (edge_attr_comb )
5004+
5005+ # Call wrapped function
5006+ igraph_to_undirected (c_graph , c_mode , c_edge_attr_comb )
49675007
49685008
49695009def read_graph_edgelist (instream : FileLike , n : int = 0 , directed : bool = True ) -> Graph :
@@ -4986,6 +5026,9 @@ def read_graph_edgelist(instream: FileLike, n: int = 0, directed: bool = True) -
49865026 # Construct return value
49875027 return graph
49885028
5029+ # Help the type checker to figure out that we never get here
5030+ assert False , "unreachable" # noqa: B011
5031+
49895032# igraph_read_graph_ncol: no Python type known for type: VECTOR_STR
49905033
49915034# igraph_read_graph_lgl: no Python type known for type: ADD_WEIGHTS
@@ -5009,6 +5052,9 @@ def read_graph_pajek(instream: FileLike) -> Graph:
50095052 # Construct return value
50105053 return graph
50115054
5055+ # Help the type checker to figure out that we never get here
5056+ assert False , "unreachable" # noqa: B011
5057+
50125058
50135059def read_graph_graphml (instream : FileLike , index : int = 0 ) -> Graph :
50145060 """Type-annotated wrapper for ``igraph_read_graph_graphml``."""
@@ -5029,6 +5075,9 @@ def read_graph_graphml(instream: FileLike, index: int = 0) -> Graph:
50295075 # Construct return value
50305076 return graph
50315077
5078+ # Help the type checker to figure out that we never get here
5079+ assert False , "unreachable" # noqa: B011
5080+
50325081# igraph_read_graph_dimacs_flow: no Python type known for type: VECTOR_STR
50335082
50345083
@@ -5051,6 +5100,9 @@ def read_graph_graphdb(instream: FileLike, directed: bool = False) -> Graph:
50515100 # Construct return value
50525101 return graph
50535102
5103+ # Help the type checker to figure out that we never get here
5104+ assert False , "unreachable" # noqa: B011
5105+
50545106
50555107def read_graph_gml (instream : FileLike ) -> Graph :
50565108 """Type-annotated wrapper for ``igraph_read_graph_gml``."""
@@ -5070,6 +5122,9 @@ def read_graph_gml(instream: FileLike) -> Graph:
50705122 # Construct return value
50715123 return graph
50725124
5125+ # Help the type checker to figure out that we never get here
5126+ assert False , "unreachable" # noqa: B011
5127+
50735128
50745129def read_graph_dl (instream : FileLike , directed : bool = True ) -> Graph :
50755130 """Type-annotated wrapper for ``igraph_read_graph_dl``."""
@@ -5090,6 +5145,9 @@ def read_graph_dl(instream: FileLike, directed: bool = True) -> Graph:
50905145 # Construct return value
50915146 return graph
50925147
5148+ # Help the type checker to figure out that we never get here
5149+ assert False , "unreachable" # noqa: B011
5150+
50935151
50945152def write_graph_edgelist (graph : Graph , outstream : FileLike ) -> None :
50955153 """Writes the graph in plain edge list format to an output stream.
0 commit comments