feat: add with_positions option to ring_lattice (#623)#729
Open
leotrs wants to merge 33 commits into
Open
Conversation
Add _stat_property non-data descriptor to expose built-in stats as class-level attributes on NodeView, EdgeView, DiNodeView, and DiEdgeView. Stats now appear in dir(), IDE autocomplete, and Jupyter tab completion. __getattr__ remains as fallback for user-defined stats registered via @nodestat_func. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add .pyi stub file declaring built-in stats as typed attributes on NodeView, EdgeView, DiNodeView, and DiEdgeView. This enables static analysis tools (Pylance, PyCharm, mypy) to provide autocomplete and type checking for the stats interface. Also adds py.typed marker and configures pyproject.toml to include stub files in package distributions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ckstart - Revise "XGI in 5 minutes" to introduce the stats interface after the histogram section: shows stat objects, output formats, filtering. - Add stats cheat sheet page with quick reference for all stats, output formats, filter modes, custom stats, and visualization integration. - Link the orphaned quickstart.ipynb from the Getting Started index. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ubuntu-20.04 has been deprecated by ReadTheDocs, causing build failures. Closes #702 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: make built-in stats discoverable in dir() and IDE autocomplete
- Add outputs to new stats cells in 5-minute notebook - Use smaller H (20 nodes, seeded) for stats demo instead of H_new (50 nodes) - Fix filter threshold to produce meaningful results - Move stats cheat sheet from top nav to User Guides page Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Stats reference page now links to cheat sheet and tutorial - Focus tutorial 6 links to cheat sheet Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
H.nodes.degree? now shows the actual degree docstring instead of the generic NodeStat class docstring. Closes #357 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Update using-xgi.rst * Fix issues with PR --------- Co-authored-by: Nicholas Landry <nicholas.landry.91@gmail.com>
feat: forward stat function docstrings to stat objects
docs: introduce stats earlier, add cheat sheet, link quickstart
feat: add type stubs for stats on view classes
* docs: automated the generation of the "Using XGI" page * Response to review: added docs and fixed formatting * docs: change reverse-alphabetical to alphabetical * response to review * Update generate_using_xgi.py
Add fields for Python and xgi versions in bug report template.
Update issue templates
Adds an empties parameter to cleanup() on Hypergraph, DiHypergraph, and SimplicialComplex. Defaults to False (matching the convention of other cleanup flags), so empty edges are removed by default. Closes #570 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Several stats are thin wrappers around xgi.algorithms functions but were carrying their own copies of the formulas, references, and notes. Those copies had drifted from the originals. Rewrites the wrapper stat docstrings to point at the algorithm via See Also rather than re-explaining. Adds a short stat-accessor note to each algorithm so users discover both calling conventions from either direction. Affects clustering_coefficient, local_clustering_coefficient, two_node_clustering_coefficient, clique_eigenvector_centrality, h_eigenvector_centrality, z_eigenvector_centrality, node_edge_centrality, katz_centrality, and the local simpliciality stats. Closes #621 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
A common confusion is that H.edges[0] returns the empty attribute dict rather than the members of edge 0. The behavior is correct but the docstring did not point users at the actual member-access methods. Add an upfront note and concrete examples showing both attribute access and the alternatives (.members, .memberships). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
feat: add empties option to cleanup methods (#570)
docs: deduplicate stats docstrings and link to algorithms (#621)
H.nodes? and H.edges? are common discovery moves; surface the attr-vs-member distinction in the class docstrings where users will actually encounter it (per Max's review on #727). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
docs: clarify that H.edges[idx] returns attributes, not members
Stores each node's coordinate on a unit circle as the "pos" node attribute. Naming follows NetworkX convention (e.g., triangular_lattice_graph(with_positions=True)). Combined with PR #728, this enables a clean redraw workflow: H = xgi.ring_lattice(8, 3, 2, 0, with_positions=True) xgi.draw(H, pos=H.nodes.pos.asdict()) Closes #623 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #729 +/- ##
=======================================
Coverage 93.68% 93.69%
=======================================
Files 66 66
Lines 5213 5217 +4
=======================================
+ Hits 4884 4888 +4
Misses 329 329 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #623. Adds a
with_positions=Falsekeyword argument toring_lattice. When True, stores each node's coordinate on a unit circle as the\"pos\"node attribute. Naming follows the NetworkX convention (e.g.,triangular_lattice_graph(with_positions=True)) as Max suggested in the issue.Combined with #728 (
H.nodes.posaccessor), the natural workflow becomes:ring_latticeis currently the only lattice generator in xgi, so this is a one-function change. Future lattice generators (e.g., triangular) should follow the same convention.Test plan
test_ring_lattice_with_positionscovers both default (no pos) andwith_positions=True(verifies unit-circle coordinates)