Skip to content

Commit a3f2c4c

Browse files
committed
fix: change default of igraph_empty() directedness to false
1 parent ea7f024 commit a3f2c4c

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/codegen/functions.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ igraph_get_shortest_path_astar:
2929
# igraph_astar_heuristic_func_t not handled yet
3030
IGNORE: PythonCTypes, PythonCTypesTypedWrapper
3131

32+
igraph_empty:
33+
# Changed the default value of 'directed' to false. Can be removed when
34+
# the main igraph repo also changes the default
35+
PARAMS: OUT GRAPH graph, INTEGER n=0, BOOLEAN directed=False
36+
3237
igraph_empty_attrs:
3338
# Not needed at all
3439
IGNORE: PythonCTypes, PythonCTypesTypedWrapper

src/igraph_ctypes/_internal/functions.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@
3636
# The rest of this file is generated by Stimulus
3737

3838

39-
def empty(n: int = 0, directed: bool = True) -> Graph:
39+
def empty(n: int = 0, directed: bool = False) -> Graph:
4040
"""Creates an empty graph with the given number of vertices.
4141
4242
Parameters:
4343
n: the number of vertices
4444
directed: whether the graph is directed
45+
46+
Returns:
47+
the newly created graph
4548
"""
4649
# Prepare input arguments
4750
c_graph = _Graph()
@@ -338,7 +341,16 @@ def is_same_graph(graph1: Graph, graph2: Graph) -> bool:
338341

339342

340343
def create(edges: Iterable[int], n: int = 0, directed: bool = True) -> Graph:
341-
"""Type-annotated wrapper for ``igraph_create``."""
344+
"""Creates a graph from the given edge list.
345+
346+
Parameters:
347+
edges: the list of edges in the graph
348+
n: the number of vertices in the graph if it cannot be inferred from
349+
the maximum edge ID in the edge list
350+
351+
Returns:
352+
the newly created graph
353+
"""
342354
# Prepare input arguments
343355
c_graph = _Graph()
344356
c_edges = iterable_to_igraph_vector_int_t_view(edges)

0 commit comments

Comments
 (0)