Skip to content

docs: reorganize the method reference by task, docstring pass, new diagram - #45

Merged
petercorke merged 10 commits into
mainfrom
docs/reorganize-method-reference
Oct 11, 2026
Merged

petercorke merged 10 commits into
mainfrom
docs/reorganize-method-reference

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

The long-delayed documentation reorganization.

  • Method reference by task, not by class. New pages: construction, modification, analysis, representations, visualization, export, planning, and edges/vertices, each with an autosummary table (precis plus hyperlinked name) above the details. Introduction and API details are separate sidebar sections with indented subheads.
  • Docstring pass over PGraph.py: parameter lists, cross-references between related methods (the degree / adjacent / edges families, incidences with adjacent and out_edges), runblock fixes (block=None, ; to suppress output), and the new API throughout (adjacent canonical, BaseGraph, laplacian, in-edges, edges() as a list).
  • Data-structures diagram as docs/figs/datastructures.svg (with its .ezdraw source), shown in the Sphinx docs; the PNG stays for the wiki link.
  • Wording: "Graphs for Python" rather than "Mathematical graphs"; says what embedding a graph gives you (metric costs, nearest vertex, A* heuristic, plotting, layout-preserving export) in the README and the introduction.
  • README corrections: adjacent() is the headline name, the base class is BaseVertex, and the graph does list its edges.

The preceding code PRs (#37 to #44) are merged, so the docs build against the new API: a full sphinx-build -E gives no warnings.

Notes

Written against main as of #44. Another documentation and diagram pass is planned once the single-vertex-class refactor lands.

🤖 Generated with Claude Code

petercorke and others added 10 commits October 12, 2026 09:43
DGraph/UGraph and DVertex/UVertex share almost their entire interface via
_BaseGraph/BaseVertex, so documenting each subclass with :inherited-members:
duplicated the full method list on every page. Split the common interface
into task-based pages instead (construction, adding/removing vertices and
edges, analysis, representations, visualization, path planning), each
pulling specific members via automethod/autoproperty to avoid duplicate
object-description warnings. Subclass pages now cover only what's actually
different (DGraph/UGraph have no public members of their own; DVertex/
UVertex override only connect()).

Also merges edge.rst and the vertex-specifics pages under a combined
"Edges & Vertices" heading, and removes PGraph.rst/modules.rst, orphaned
sphinx-quickstart/apidoc leftovers that were never wired into the toctree
and were the source of most duplicate-object warnings in a full build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Introduction and API details are documents, so each shows in the sidebar
  with its sub-headings indented (navigation_depth 3, collapse_navigation off)
- every method page opens with an autosummary table of its methods, with the
  one-line summary and a link to the entry below it
- add Introduction, API details and Exporting a graph pages, with inheritance
  diagrams for the graph, vertex and edge classes on the common page
- fold DGraph/UGraph into the construction page and remove the dgraph and
  ugraph pages that documented the same classes a second time
- drop the display_version theme option, which sphinx_rtd_theme no longer
  accepts

The build has no warnings and no runblock errors.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Docstrings only (the code is unchanged apart from the docstrings, checked by
comparing the AST with docstrings removed).

- document the behaviour with self-loops and parallel edges, and the
  exceptions each method raises
- cross-reference the related methods: component/samecomponent/nc and the
  degree family (degree, connectivity, average_degree, BaseVertex.degree)
- connectivity() and BaseVertex.edges() now say which edges they return for
  each graph kind, and that an undirected self-loop counts twice
- vertex_class/edge_class properties say they are set by the constructor
- examples that show a figure use block=None, so they no longer emit the
  non-interactive-backend warning that runblock reports as an error

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- add docs/figs/datastructures.svg, exported from the EazyDraw source, and
  move the source to docs/figs/ with the other figures
- show it at the top of the Edges & Vertices page under 'Underlying data
  structures', followed by a short description, and split the page into
  that section and 'Working with vertices and edges directly'
- remove the 'Under the hood' section from the README, which embedded the
  old PNG by URL

docs/source/datastructures.png is kept for now because the wiki still links
to it by URL.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Export with the font set to Outline, so the figure no longer depends on
Avenir, Bradley Hand and Courier being installed. With live text a viewer
without those fonts (anything but macOS) got a generic face and three
callouts overflowed their boxes.

The export writes path coordinates with nine decimal places, giving 1.2 MB.
Rounded to three decimals, and only inside d= attributes, it is 708 KB
(220 KB gzipped) and differs from the original in 94 of 4.4 million pixels
at 2000 px wide.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The opening paragraph mentioned 'embedded coordinates' only in passing. Say
that embedding is optional and what it enables: edge costs computed from the
vertex positions with a metric, nearest-vertex lookup, A* with the metric as
its heuristic, and plotting or export with the layout preserved.

Drop 'not a plotting library', which contradicted that.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- BaseGraph, not _BaseGraph, in every autoclass/automethod/autosummary
  directive (67 references)
- analysis.rst lists adjacent() and isadjacent(), the canonical names, and
  not the neighbours/neighbors/isneighbour aliases

These need the API changes in the source, so the build reads the new code only
after this branch is rebased onto them; against the 0.6.5-era source the names
do not exist.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Laplacian is laplacian, _BaseGraph is BaseGraph, and the vertex pages
list adjacent rather than neighbours.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.79%. Comparing base (9fe9d61) to head (2136091).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #45   +/-   ##
=======================================
  Coverage   94.79%   94.79%           
=======================================
  Files           3        3           
  Lines        1249     1249           
=======================================
  Hits         1184     1184           
  Misses         65       65           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@petercorke
petercorke merged commit 3376eb5 into main Oct 11, 2026
14 checks passed
@petercorke
petercorke deleted the docs/reorganize-method-reference branch October 11, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant