|
1 | 1 | from typing import Iterable, Union |
2 | 2 |
|
3 | 3 | from .graph import Graph |
4 | | -from ._internal.functions import create, empty, famous, grg_game, square_lattice |
| 4 | +from ._internal.functions import ( |
| 5 | + create as create_graph_from_edge_list, |
| 6 | + empty as create_empty_graph, |
| 7 | + famous as create_famous_graph, |
| 8 | + grg_game, |
| 9 | + square_lattice, |
| 10 | +) |
5 | 11 |
|
6 | 12 | __all__ = ( |
7 | 13 | "create_empty_graph", |
|
12 | 18 | ) |
13 | 19 |
|
14 | 20 |
|
15 | | -def create_empty_graph(n: int, directed: bool = False) -> Graph: |
16 | | - """Creates an empty graph with the given number of vertices. |
17 | | -
|
18 | | - Parameters: |
19 | | - n: the number of vertices |
20 | | - directed: whether the graph is directed |
21 | | - """ |
22 | | - return empty(n, directed) |
23 | | - |
24 | | - |
25 | | -def create_famous_graph(name: str) -> Graph: |
26 | | - """Creates one of the "famous" graphs embedded into igraph by name. |
27 | | -
|
28 | | - See the documentation of the ``igraph_famous()`` function in igraph's C core |
29 | | - for a list of names accepted by this function. |
30 | | -
|
31 | | - Parameters: |
32 | | - name: the name of the graph to construct |
33 | | - """ |
34 | | - return famous(name) |
35 | | - |
36 | | - |
37 | | -def create_graph_from_edge_list( |
38 | | - edges: Iterable[int], n: int = 0, directed: bool = False |
39 | | -) -> Graph: |
40 | | - """Creates a graph from the given edge list. |
41 | | -
|
42 | | - Parameters: |
43 | | - edges: the list of edges in the graph |
44 | | - n: the number of vertices in the graph if it cannot be inferred from |
45 | | - the maximum edge ID in the edge list |
46 | | - """ |
47 | | - return create(edges, n, directed) |
48 | | - |
49 | | - |
50 | 21 | def create_square_lattice( |
51 | 22 | dimvector: Iterable[int], |
52 | 23 | nei: int = 1, |
|
0 commit comments