Skip to content

Commit 07d9f54

Browse files
committed
doc: moar docs!
1 parent 10c1fe4 commit 07d9f54

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

docs/api/constructors.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Graph constructors
2+
3+
## `igraph_ctypes.constructors` module
4+
5+
::: igraph_ctypes.constructors
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Reference
1+
# The Graph class
22

33
::: igraph_ctypes.Graph

docs/api/paths.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Shortest paths and components
2+
3+
## `igraph_ctypes.paths` module
4+
5+
::: igraph_ctypes.paths

mkdocs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
site_name: igraph ctypes interface for Python
22
repo_url: https://github.com/igraph/python-igraph-ctypes
3-
# repo_name: igraph/python-igraph-ctypes
43

54
nav:
65
- Home: index.md
76
- Notes: notes.md
8-
- API reference: reference.md
7+
- API reference:
8+
- api/graph.md
9+
- api/constructors.md
10+
- api/paths.md
11+
12+
exclude_docs: |
13+
fragments/
914
1015
theme:
1116
name: material
1217

1318
features:
1419
- content.action.edit
20+
- content.code.copy
1521
- navigation.instant
1622
- navigation.tracking
1723
- navigation.footer
@@ -63,4 +69,3 @@ plugins:
6369
- src
6470
options:
6571
show_source: false
66-

src/igraph_ctypes/paths.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@
1616
__all__ = ("components", "shortest_path")
1717

1818

19-
def components(graph: Graph, mode: Connectedness = Connectedness.WEAK):
19+
def components(graph: Graph, mode: Connectedness = Connectedness.WEAK) -> IntArray:
20+
"""Finds the weakly or strongly connected components of a graph.
21+
22+
Args:
23+
graph: the graph
24+
mode: whether the function should return weakly or strongly connected
25+
components
26+
"""
2027
membership, _, _ = connected_components(graph, mode)
2128
return membership
2229

@@ -29,6 +36,22 @@ def shortest_path(
2936
weights: Optional[Iterable[float]] = None,
3037
method: str = "dijkstra",
3138
) -> IntArray:
39+
"""Finds a single shortest path between two vertices in a graph.
40+
41+
Args:
42+
graph: the graph
43+
source: the source vertex
44+
target: the target vertex
45+
mode: TODO
46+
weights: list of weights for each edge in the graph, or ``None`` to treat
47+
the edges as unweighted
48+
method: the method to use for finding shortest paths when the graph is
49+
weighted. May be one of `"dijkstra"` (Dijkstra's algorithm) or
50+
`"bellman-ford"` (Bellman-Ford algorithm).
51+
52+
Returns:
53+
the IDs of the vertices along the shortest path
54+
"""
3255
# TODO(ntamas): handle epath?
3356
if weights is None:
3457
vpath, _ = get_shortest_path(graph, source, target, mode)

0 commit comments

Comments
 (0)