Skip to content

Commit da95b9b

Browse files
committed
Minor cleanup in docs
1 parent c97180f commit da95b9b

9 files changed

Lines changed: 68 additions & 68 deletions

docs/configuration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The `transforms` extra installs `networkx`, `rustworkx`, and `pandas`.
1616

1717
## Requirements
1818

19-
- **PostgreSQL** required. django-postgresql-dag uses recursive CTEs (`WITH RECURSIVE`), which are PostgreSQL-specific. It is not compatible with SQLite, MySQL, or other databases.
19+
- **PostgreSQL** - required. django-postgresql-dag uses recursive CTEs (`WITH RECURSIVE`), which are PostgreSQL-specific. It is not compatible with SQLite, MySQL, or other databases.
2020
- **Supported primary key types**: `integer`, `bigint`, `uuid`. The query builders handle type casting automatically.
2121

2222
## Django settings
@@ -41,12 +41,12 @@ Creates an abstract base class for your Edge model.
4141
| Parameter | Type | Default | Description |
4242
|---|---|---|---|
4343
| `node_model` | `str` or model class | *(required)* | The Node model this edge connects. Use a string name (e.g. `"MyNode"`) when the Node class hasn't been defined yet. |
44-
| `concrete` | `bool` | `True` | If `True`, the factory returns a concrete model. If `False`, returns an abstract model your subclass provides the database table. Almost always set to `False`. |
44+
| `concrete` | `bool` | `True` | If `True`, the factory returns a concrete model. If `False`, returns an abstract model - your subclass provides the database table. Almost always set to `False`. |
4545
| `base_model` | model class | `models.Model` | Base class for the generated model. Use this to inject a custom base (e.g. a TimeStampedModel). |
4646

4747
The generated model provides:
48-
- `parent` ForeignKey to the node model (the "from" side)
49-
- `child` ForeignKey to the node model (the "to" side)
48+
- `parent` - ForeignKey to the node model (the "from" side)
49+
- `child` - ForeignKey to the node model (the "to" side)
5050
- Circular reference checking on save (unless disabled)
5151
- Duplicate edge checking on save (unless disabled)
5252

@@ -61,7 +61,7 @@ Creates an abstract base class for your Node model.
6161
| `base_model` | model class | `models.Model` | Base class for the generated model. |
6262

6363
The generated model provides:
64-
- `children` ManyToManyField through the edge model
64+
- `children` - ManyToManyField through the edge model
6565
- All traversal, path, predicate, and mutation methods (see [Node API Reference](node-reference.md))
6666
- Custom manager with `roots()`, `leaves()`, `topological_sort()`, and other graph-wide methods
6767

docs/debug.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ def debug_my_operation():
5353

5454
These operations are captured when called inside a `log_queries` block:
5555

56-
- `ancestors()` / `ancestors_raw()` records `AncestorQuery`
57-
- `descendants()` / `descendants_raw()` records `DescendantQuery`
58-
- `path()` / `path_raw()` records `DownwardPathQuery` and/or `UpwardPathQuery`
59-
- `connected_graph()` / `connected_graph_raw()` records `ConnectedGraphQuery`
60-
- `node_depth()` records `node_depth`
56+
- `ancestors()` / `ancestors_raw()` - records `AncestorQuery`
57+
- `descendants()` / `descendants_raw()` - records `DescendantQuery`
58+
- `path()` / `path_raw()` - records `DownwardPathQuery` and/or `UpwardPathQuery`
59+
- `connected_graph()` / `connected_graph_raw()` - records `ConnectedGraphQuery`
60+
- `node_depth()` - records `node_depth`
6161

6262
## `DAGQueryLog` reference
6363

6464
The object returned by `log_queries().__enter__()` is a `DAGQueryLog` instance with:
6565

66-
- **`queries`** (`list[dict]`) each entry has:
66+
- **`queries`** (`list[dict]`) - each entry has:
6767
- `query_class` (str): the query builder class name (e.g. `"DescendantQuery"`) or `"node_depth"`
6868
- `sql` (str): the formatted CTE SQL template
6969
- `params` (dict): the parameters passed to the query
70-
- **`executed`** (`list[dict]`) only populated when `capture_executed=True`. Each entry has:
70+
- **`executed`** (`list[dict]`) - only populated when `capture_executed=True`. Each entry has:
7171
- `sql` (str): the actual SQL executed by Django
7272
- `time` (str): execution time in seconds

docs/edge-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ These are called on `MyEdge.objects`.
2222
: Returns a QuerySet of edges forming the shortest path from `start_node` to `end_node`. Accepts `directional` (default `True`).
2323

2424
**redundant_edges(self)**
25-
: Returns a QuerySet of redundant edges those removable by transitive reduction. An edge A→C is redundant if C is reachable from A via a path of length >= 2.
25+
: Returns a QuerySet of redundant edges - those removable by transitive reduction. An edge A→C is redundant if C is reachable from A via a path of length >= 2.
2626

2727
**transitive_reduction(self, delete=False)**
2828
: Identifies redundant edges. With `delete=True`, removes them and returns the count. See also `NodeManager.transitive_reduction()`.

docs/filtering.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Filtering Graph Traversals
22

3-
All traversal methods (`ancestors()`, `descendants()`, `clan()`, `path()`, `connected_graph()`, and their variants) accept filtering parameters that control which parts of the graph are explored. These filters operate at the CTE level excluded edges are never traversed, not just hidden from results.
3+
All traversal methods (`ancestors()`, `descendants()`, `clan()`, `path()`, `connected_graph()`, and their variants) accept filtering parameters that control which parts of the graph are explored. These filters operate at the CTE level - excluded edges are never traversed, not just hidden from results.
44

55
## Limiting depth with `max_depth`
66

@@ -70,7 +70,7 @@ Pass a queryset of edge instances to exclude from traversal. The CTE will skip t
7070
>>> node.path(target, disallowed_edges_queryset=edge_to_skip)
7171
```
7272

73-
This is useful for "what if" scenarios exploring the graph as it would look with certain connections removed, without actually deleting them.
73+
This is useful for "what if" scenarios - exploring the graph as it would look with certain connections removed, without actually deleting them.
7474

7575
## Restricting to specific edges with `allowed_edges_queryset`
7676

docs/node-reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ These are called on `MyNode.objects`.
1616
: Returns a list of QuerySets, one per disconnected subgraph. Each QuerySet can be further filtered.
1717

1818
**graph_stats(self)**
19-
: Returns a dict with aggregate metrics: `node_count`, `edge_count`, `root_count`, `leaf_count`, `island_count`, `max_depth`, `avg_depth`, `density`, `component_count`. Runs O(N) queries suitable for analytics, not hot paths.
19+
: Returns a dict with aggregate metrics: `node_count`, `edge_count`, `root_count`, `leaf_count`, `island_count`, `max_depth`, `avg_depth`, `density`, `component_count`. Runs O(N) queries - suitable for analytics, not hot paths.
2020

2121
**topological_sort(self, max_depth=None)**
2222
: Returns a QuerySet of all nodes in topological order (parents before children). Island nodes are included at the front.
@@ -102,7 +102,7 @@ All traversal methods accept optional keyword arguments for [filtering](filterin
102102
## Path Methods
103103

104104
**path(self, ending_node, \*\*kwargs)**
105-
: Returns a QuerySet of the shortest path from self to `ending_node`. Sorted root-side toward leaf-side regardless of direction. Raises `NodeNotReachableException` if no path exists. Accepts `directional` (default `True`) set to `False` to search in both directions.
105+
: Returns a QuerySet of the shortest path from self to `ending_node`. Sorted root-side toward leaf-side regardless of direction. Raises `NodeNotReachableException` if no path exists. Accepts `directional` (default `True`) - set to `False` to search in both directions.
106106

107107
**path_exists(self, ending_node, \*\*kwargs)**
108108
: Returns `True` if a path exists from self to `ending_node`. Accepts `directional`.
@@ -114,7 +114,7 @@ All traversal methods accept optional keyword arguments for [filtering](filterin
114114
: Returns a list of QuerySets, each representing one path. Unlike `path()`, returns all paths, not just the shortest.
115115

116116
**all_paths_as_pk_lists(self, ending_node, directional=True, max_results=None, \*\*kwargs)**
117-
: Returns a list of PK lists lightweight alternative to `all_paths()`.
117+
: Returns a list of PK lists - lightweight alternative to `all_paths()`.
118118

119119
**weighted_path(self, ending_node, weight_field="weight", \*\*kwargs)**
120120
: Returns a `(QuerySet, total_weight)` tuple for the minimum-weight path. The edge model must have the specified weight field. Raises `NodeNotReachableException` or `WeightFieldDoesNotExistException`.

docs/paths-and-algorithms.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Working with Paths and Algorithms
22

3-
Beyond basic ancestor/descendant traversal, django-postgresql-dag provides several graph algorithms all implemented as PostgreSQL recursive CTEs or using the NetworkX library.
3+
Beyond basic ancestor/descendant traversal, django-postgresql-dag provides several graph algorithms - all implemented as PostgreSQL recursive CTEs or using the NetworkX library.
44

55
The examples on this page use the graph from the [Quickstart](quickstart.md):
66

@@ -62,7 +62,7 @@ For lightweight processing, `all_paths_as_pk_lists()` returns lists of primary k
6262
[[1, 4, 7, 9], [1, 4, 8, 9]]
6363
```
6464

65-
Use `max_results` to cap the number of paths returned useful in dense graphs:
65+
Use `max_results` to cap the number of paths returned - useful in dense graphs:
6666

6767
```python
6868
>>> root.all_paths(c1, max_results=1)
@@ -120,7 +120,7 @@ At the instance level, get a node and its descendants in topological order:
120120

121121
## Critical path
122122

123-
The critical path is the longest weighted path from any root to any leaf in the DAG. This is useful for project scheduling the critical path determines the minimum total duration.
123+
The critical path is the longest weighted path from any root to any leaf in the DAG. This is useful for project scheduling - the critical path determines the minimum total duration.
124124

125125
```python
126126
>>> path_qs, total_weight = NetworkNode.objects.critical_path(weight_field="weight")
@@ -175,7 +175,7 @@ Annotate nodes with their distance from the current node:
175175

176176
Transitive reduction removes redundant edges. An edge A → C is redundant if C is already reachable from A through other paths (of length >= 2).
177177

178-
Dry run find redundant edges without removing them:
178+
Dry run - find redundant edges without removing them:
179179

180180
```python
181181
>>> NetworkNode.objects.transitive_reduction()

docs/transformations.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ This installs `networkx`, `rustworkx`, and `pandas`.
1414

1515
## Common parameters
1616

17-
All export functions accept a queryset of either nodes or edges. The queryset type is detected automatically pass a nodes queryset and the corresponding edges are looked up, or vice versa.
17+
All export functions accept a queryset of either nodes or edges. The queryset type is detected automatically - pass a nodes queryset and the corresponding edges are looked up, or vice versa.
1818

1919
These parameters are shared across `nx_from_queryset`, `rx_from_queryset`, and `json_from_queryset`:
2020

21-
- `node_attribute_fields_list` field names to include as attributes on each node
22-
- `edge_attribute_fields_list` field names to include as attributes on each edge
23-
- `date_strf` strftime format string for date-like fields (e.g. `"%Y-%m-%d"`)
24-
- `digraph` `True` for a directed graph, `False` (default) for undirected
21+
- `node_attribute_fields_list` - field names to include as attributes on each node
22+
- `edge_attribute_fields_list` - field names to include as attributes on each edge
23+
- `date_strf` - strftime format string for date-like fields (e.g. `"%Y-%m-%d"`)
24+
- `digraph` - `True` for a directed graph, `False` (default) for undirected
2525

2626
## NetworkX export
2727

@@ -158,11 +158,11 @@ True
158158

159159
The output follows the node-link JSON format with these top-level keys:
160160

161-
- `directed` whether the graph is directed
162-
- `multigraph` whether the graph allows multiple edges
163-
- `attrs` graph-level attributes
164-
- `nodes` list of node objects, each with `id` (index) and `data` dict
165-
- `links` list of edge objects, each with `source`, `target`, `id`, and `data` dict
161+
- `directed` - whether the graph is directed
162+
- `multigraph` - whether the graph allows multiple edges
163+
- `attrs` - graph-level attributes
164+
- `nodes` - list of node objects, each with `id` (index) and `data` dict
165+
- `links` - list of edge objects, each with `source`, `target`, `id`, and `data` dict
166166

167167
By default, `digraph=False` produces undirected output:
168168

@@ -202,7 +202,7 @@ These functions use NetworkX's Weisfeiler-Lehman algorithm to compute structural
202202
True
203203
```
204204

205-
WL hashing is not collision-free hash equality is necessary but not sufficient for true isomorphism.
205+
WL hashing is not collision-free - hash equality is necessary but not sufficient for true isomorphism.
206206

207207
These functions also have node-level convenience methods that use lazy imports (so NetworkX isn't required at import time):
208208

@@ -217,8 +217,8 @@ Scope options: `"connected"`, `"descendants"`, `"ancestors"`, `"clan"`.
217217

218218
These functions are used internally by the export functions, but can be useful when working with querysets directly.
219219

220-
**`edges_from_nodes_queryset(nodes_queryset)`** Given a queryset of nodes, returns a queryset of all edges where both parent and child are in the provided nodes.
220+
**`edges_from_nodes_queryset(nodes_queryset)`** - Given a queryset of nodes, returns a queryset of all edges where both parent and child are in the provided nodes.
221221

222-
**`nodes_from_edges_queryset(edges_queryset)`** Given a queryset of edges, returns a queryset of all nodes that appear as a parent or child in the provided edges.
222+
**`nodes_from_edges_queryset(edges_queryset)`** - Given a queryset of edges, returns a queryset of all nodes that appear as a parent or child in the provided edges.
223223

224-
**`model_to_dict(instance, fields=None, date_strf=None)`** Converts a model instance to a dictionary for the specified fields. Handles ForeignKeys, ManyToMany fields (with `__` subfield lookup), dates, UUIDs, file fields, and callable methods.
224+
**`model_to_dict(instance, fields=None, date_strf=None)`** - Converts a model instance to a dictionary for the specified fields. Handles ForeignKeys, ManyToMany fields (with `__` subfield lookup), dates, UUIDs, file fields, and callable methods.

0 commit comments

Comments
 (0)