-
Notifications
You must be signed in to change notification settings - Fork 1
V1 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V1 #4
Conversation
Major changes: 1. Removed dependency on HALP. As a consequence, added self.edge_mapping and self.node_set_to_hyperedge to map arcs to ids. Node profiles are now mapped to self.node_profiles (node: tid: NProfile) and stars to self.stars (node: edge id set) 2. self.time_to_edge. Mapped tid: edge : event. Handling this mapping is the most expensive thing. Removing it gives a considerable boost in performance when creating large hypergraphs. Requires changing stream_interactions (the only function that really used it). 3. Stream_interactions. Can no longer simply iterate over time_to_edge. Now: If hedge_removal is False, it yields temporally ordered hyperedges (one iteration for each non-contiguous appearance). If hedge_removal is True, it instead (i) yields the first snapshot, (ii) for each subsequent instant, yields the additions checking that they are not present at the previous instant, then yields the removals checking that they are not present at the next instant. 4. Added a warning: hedge removal not implemented 5. add_nodes. Faster because it does not do time checks. Overwrites if the node already exists. (When working on it, therefore, add arcs first, then node attributes) 6. various bug fixes, incl. neighbors counting
… update related tests
- Created subdirectories: unit/, paths/, measures/, utils/, generators/, io/, viz/, integration/, fixtures/ - Added conftest.py with shared fixtures (rng, ash_factory, small_hg, matplotlib_agg) - Created fixtures/sample_hypergraphs.py with reusable test hypergraph factories - Moved all existing tests to appropriate subdirectories - Added 38 new tests: * measures/test_segregation.py: 16 tests for RWHS measures * integration/test_backends.py: 15 tests for Dense/Interval backend parity * integration/test_workflows.py: 7 end-to-end workflow tests - Fixed integration test API signatures - Copied hif_data to io/ subdirectory for I/O tests - All 189 tests passing (161 original + 28 new without duplicates) - Maintained 95% code coverage
- Implements multi-ego network extraction for temporal hypergraphs - Three extraction variants: standard, fractured (alpha), core (beta) - Three similarity measures: Jaccard, minimum overlapping, delta - Supports single snapshot and time window queries (start/end) - 28 comprehensive tests (all passing) - API consistent with ASH.star() and temporal conventions
- Convert docstrings from NumPy to Sphinx style (:param:, :return:) - Add docs/reference/multiego.rst with autosummary - Include multiego in docs/reference/reference.rst - All 28 tests passing - Consistent with ASH documentation standards
- Add conftest.py with shared fixtures - Create fixtures/sample_hypergraphs.py for reusable test data - Organize tests in subdirectories: integration/, measures/, viz/ - Add comprehensive integration tests (backends, workflows) - Add visualization tests (static and temporal) - Improve test isolation and maintainability - All 228 tests passing
- Update temporal parameters (start/end) to use Optional[int] for PEP 484 compliance - Add Optional to typing imports in s_centralities.py, projections.py, matrices.py - Fix s_eigenvector_centrality: add missing weight parameter - Fix s_load_centrality: correct docstring parameters - Improves IDE support, type checking, and code clarity - No behavioral changes, type system only - Affected: 15 functions across 3 modules - All tests pass (test_centralities.py, test_utils.py)
- Changed documentation theme from sphinx_rtd_theme to Furo for better logo visibility - Furo provides modern design with dark sidebar that makes the orange logo stand out - Fixed logo configuration to prevent duplication - Moved logo to _static directory for proper Furo integration - Reorganized reference.rst: moved multiego from Measures to its own MultiEgo section
- Add ash_model.viz.static: functions for static hypergraph visualization - plot_s_degrees: visualize s-degree distribution - plot_hyperedge_size_distribution: hyperedge size distribution - plot_degree_distribution: node degree distribution (log-log) - plot_s_ranks: s-rank distribution - Add ash_model.viz.temporal: functions for temporal hypergraph visualization - plot_hyperedge_activity_series: activity over time for hyperedges - plot_node_activity_series: activity over time for nodes - plot_node_presence_timeline: presence intervals for nodes - plot_hyperedge_presence_timeline: presence intervals for hyperedges - plot_interevent_time_distribution: time between consecutive events - plot_lifespan_distribution: lifespan distribution for nodes/hyperedges - Add docs/reference/viz.rst: comprehensive documentation with separate sections for static and temporal plots - Fixed docstring formatting issues to eliminate Sphinx warnings - Standardized parameter naming: 'normalize' (American English) across all functions
- Add generated autosummary documentation for multiego functions - Includes docs for delta_similarity, jaccard_similarity, minimum_overlap - Includes docs for get_core_multiego, get_multiego, get_fractures
- Remove same-timestamp edges: DAG now only creates edges from timestamp t to t' where t' > t - Each step in a time-respecting walk must happen at a strictly later timestamp - Optimize walk validation from O(n²) to O(n) by tracking prev_edge directly - Update temporal_s_dag to build only forward-in-time connections - Fix ping-pong detection to avoid redundant seq.index() calls Tests updated: - test_time_respecting_walks.py: All 5 tests passing with correct expectations - test_randwalks.py: Updated hypergraphs to use multi-timestamp scenarios - test_time_respecting_randwalks.py: Updated validation for strictly increasing timestamps Time-respecting walk constraints now correctly enforced: ✓ Each edge happens at a specific time t ✓ Can only move along edges that exist at that time ✓ Every next step must happen later in time (no backtracking, no same-time transitions)
Major improvements to time-respecting walks and random walks: **Time-Respecting Random Walks:** - Removed terminate_at_sink parameter (redundant with corrected logic) - Walks always terminate at temporal sinks (nodes with no forward neighbors) - Simplified API: walks stop automatically when no forward transitions exist - Updated docstring to reflect corrected behavior **Test Suite Enhancements:** - Added comprehensive test coverage for complex temporal networks - New test_complex_temporal_network: 11 hyperedges, 12 timestamps, 8 nodes - New test_larger_network_* tests: 15 hyperedges, 10 timestamps, 8 nodes - Tests verify walks spanning >2 timestamps with temporal diversity - Updated test expectations to match corrected time-respecting semantics **Test Improvements:** - test_time_respecting_walks.py: Added test_complex_temporal_network - test_time_respecting_randwalks.py: Added 3 comprehensive tests: * test_larger_network_node_walks (50 walks, length 8) * test_larger_network_edge_walks_long_paths (walks up to 10 steps) * test_larger_network_temporal_span_coverage (diversity metrics) - test_randwalks.py: Removed terminate_at_sink parameter usage **Coverage Statistics:** - Max timestamps tested: 12 (previously 5) - Max hyperedges tested: 15 (previously 5) - Max nodes tested: 8 (previously 4) - Temporal span: 6-10 timestamps (previously ~4) - All 38 tests in paths module passing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR represents a major version release (v1.0.0) of the ASH (Attributed Stream Hypergraph) library, introducing comprehensive tutorial notebooks, extensive documentation improvements, and important dependency updates.
Key changes:
- Version bump from 0.1.0 to 1.0.0
- Addition of 6 comprehensive tutorial notebooks covering all major library features
- Complete documentation restructuring with improved organization and API references
- Dependency updates including removal of deprecated
halplibrary and addition ofcsrgraph
Reviewed Changes
Copilot reviewed 171 out of 180 changed files in this pull request and generated 48 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Version bumped to 1.0.0, formatting standardized to double quotes |
| requirements.txt | Updated dependencies: removed halp/seaborn/pandas, added csrgraph, pinned numpy<2.0 |
| environment.yml | New conda environment file with Python>=3.9 and key dependencies |
| tutorial/*.ipynb | 6 new comprehensive tutorial notebooks (basics, attributes, walks, generators, I/O, multiego, segregation) |
| docs/tutorial.rst | Complete restructure referencing new tutorial notebooks with progressive organization |
| docs/reference/*.rst | Reorganized API documentation with improved structure and autosummary support |
| docs/conf.py | Major update: switched to Furo theme, added nbsphinx support, improved autodoc configuration |
| docs/requirements.txt | New documentation build dependencies including sphinx, furo, nbsphinx |
| ash_model/viz/static.py | Updated API calls from deprecated methods (get_node_set→nodes, get_degree→degree, get_s_degree→s_degree) |
| ash_model/utils/init.py | Updated imports reflecting module reorganization (matrices, projections, networkx, profiles) |
| conda/* | New conda build configuration files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| about: | ||
| home: https://github.com/GiulioRossetti/ASH | ||
| license: BSD-2-Clause | ||
| license_familY: BSD |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "license_familY" should be "license_family" (lowercase 'y')
| "All methods in this module share the following characteristics:\n", | ||
| "1. They return results for all attributes;\n", | ||
| "2. Their return type is a dictionary, typically containing the attribute name (or value) and the corresponding score;\n", | ||
| "3. Imternally, they process <code>NProfile</code> objects. If you are not familiar with them, see the corresponding section in the \"basics\" tutorial notebook.\n", |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "Imternally" should be "Internally"
| ~~~ | ||
| HIF (Hypergraph Interchange Format) is a file format designed for representing hypergraphs. It is particularly useful for storing and exchanging hypergraph data due to its simplicity and human-readability. | ||
|
|
||
| Read more about HIF `here <https://github.com/pszufe/HIF-standard/tree/main>`_ |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space before "here" in the link text. Should be a single space after the period.
| # file should either not exist or only header | ||
| lines = open(tf.name).read().splitlines() | ||
| # no header written (no nodes) | ||
| self.assertTrue(len(lines) in (0, 1)) |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertTrue(a in b) cannot provide an informative message. Using assertIn(a, b) instead will give more informative messages.
| # At least one short walk should be produced | ||
| self.assertGreaterEqual(len(walks), 1) | ||
| for w in walks: | ||
| self.assertTrue(len(w) >= 1) |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertTrue(a >= b) cannot provide an informative message. Using assertGreaterEqual(a, b) instead will give more informative messages.
| """Integration tests for complete analysis workflows.""" | ||
|
|
||
| import unittest | ||
| import numpy as np |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'np' is not used.
|
|
||
| def test_hif_ash(self): | ||
| import fastjsonschema | ||
| import json |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import of module json is redundant, as it was previously imported on line 3.
| ############################################################################### | ||
|
|
||
|
|
||
| class _SnapshotMutable(set): |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
|
|
||
| class NProfile(object): | ||
| class NProfile: |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class implements le, but does not implement lt or gt.
| try: | ||
| write_profiles_to_csv(empty, tf.name) | ||
| # file should either not exist or only header | ||
| lines = open(tf.name).read().splitlines() |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File is opened but is not closed.
No description provided.