Skip to content

docs: second documentation pass for the single Vertex class - #49

Merged
petercorke merged 4 commits into
mainfrom
docs/unified-vertex-pass
Oct 12, 2026
Merged

petercorke merged 4 commits into
mainfrom
docs/unified-vertex-pass

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

The second documentation pass, following the single Vertex class (#47) and edges_to (#48). Three commits: the rst/README text, the redrawn data-structures diagram, and docstring corrections.

Coverage. Every public class and method is in the Sphinx tree, checked against Sphinx's own object inventory. This needed:

  • Vertex is documented as a class (it had no entry once uvertex.rst/dvertex.rst went), with Edge on the same page; edge.rst is removed so nothing is orphaned or listed twice
  • the analysis tables cover every query (36 entries, grouped by theme), including directed, validate, name, label, successors, predecessors, in/out edges and degree, edgeto and edges_to
  • the pgraph.exporters module (formats, adding a format of your own) is in the Export page
  • Vertex.copy, Edge.cost and Edge.data have entries

Correctness. Found by reading every page and running the examples:

  • Edge(v1, v2) is not equivalent to Edge().connect(v1, v2) (the first does not add the edge to the graph)
  • README: path_Astar returns a tuple, samecomponent is a graph method, remove() is deprecated
  • stale wording about "directed and undirected vertex classes", path_BFS as "optimal", the policy page's links and its claim about edge cost without a graph

Presentation. An intro figure for "What is a graph?" (undirected and directed, with parallel edges, antiparallel edges and a loop); Graph(directed=...) in the intro and construction pages; headings show Graph rather than pgraph.PGraph.Graph (add_module_names = False); the redrawn data-structures diagram, compacted from 2.9 MB to 1.6 MB with no pixel differing by more than 5%.

Checks

  • sphinx-build -E: 0 warnings (the nitpicky build went from 91 warnings to 9, six of which are numpy/typing noise)
  • 490 tests pass; mypy clean
  • source changes are docstrings only, plus the text of one internal error message ("shouldnt happen")

Not in this PR

DGraph.plot() draws no arrowheads (and parallel edges and loops are invisible in plot()). That is a separate code change, parked for its own branch.

🤖 Generated with Claude Code

petercorke and others added 4 commits October 12, 2026 12:15
- analysis: the tables are grouped by theme (graph size and kind, structure,
  geometry; a vertex's identity, adjacent vertices, incident edges, degree,
  distance) and cover every query, including directed, validate, name, label,
  successors, predecessors, in/out edges and degree, edgeto and edges_to
- edges and vertices: the Vertex and Edge classes are documented there, and
  edge.rst is removed, so nothing is orphaned or listed twice; the data
  structures paragraph says what each kind of vertex holds
- export: the exporters module is documented, including how to add a format
- intro: a figure for 'What is a graph?' showing an undirected and a directed
  graph with parallel edges, antiparallel edges and a loop; Graph(directed=)
- construction: Graph(directed=...), copying a vertex
- planning, visualization, common, policy, modification: corrected wording
  and cross references; the policy page no longer refers to UGraph.add_vertex
- README: path_Astar returns a tuple, samecomponent is a graph method,
  remove() is deprecated, subclassing wording
- conf: add_module_names = False, so headings show Graph, not pgraph.PGraph.Graph

Fixes the wrong claim that Edge(v1, v2) is equivalent to Edge().connect(),
and the typos found in a read through.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Shows the graph's vertex list and edge dict, a vertex's edge list, and for a
directed graph a separate in-list, with the start and end vertex of an edge
labelled.  The export is outlined text with path coordinates rounded to three
decimals, which is visually identical (no pixel differs by more than 5%) and
1.6 MB rather than 2.9 MB.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Class docstring for Graph (so the construction table has a precis), Edge's
cost and data are documented attributes, the precis of edges, Vertex.edges and
edgeto say what they return, cross references that did not resolve, and
typos.  The only change to code is the text of an internal error message.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
datastructures.svg is exported from this file, so they are kept together.

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 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.37%. Comparing base (c64ffe1) to head (025df3c).

Files with missing lines Patch % Lines
src/pgraph/PGraph.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #49   +/-   ##
=======================================
  Coverage   95.37%   95.37%           
=======================================
  Files           3        3           
  Lines        1277     1277           
=======================================
  Hits         1218     1218           
  Misses         59       59           

☔ 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 6e2e81a into main Oct 12, 2026
13 of 14 checks passed
@petercorke
petercorke deleted the docs/unified-vertex-pass branch October 12, 2026 02:19
@petercorke petercorke mentioned this pull request Oct 12, 2026
2 tasks done
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