Skip to content

Conversation

IsaacFigNewton
Copy link

I created 2 interfaces with code shared across the different core Hypergraph classes.
Below is a Mermaid diagram indicating the inheritance hierarchy.

classDiagram
    class IHypergraph
    class DirectedHypergraph
    class IUndirectedHypergraph
    class Hypergraph
    class MultiplexHypergraph
    class TemporalHypergraph

    IHypergraph <|-- DirectedHypergraph
    IHypergraph <|-- IUndirectedHypergraph
    IUndirectedHypergraph <|-- Hypergraph
    IUndirectedHypergraph <|-- MultiplexHypergraph
    IUndirectedHypergraph <|-- TemporalHypergraph
Loading

I've included detailed commit messages, as well as comments describing my changes.
The key differences in functionality now, though are:

  • Instead of using edge_id's to access values in the _edge_metadata structures, I've set them up to index them directly, using the edges' tuples. The previous method seemed needlessly complicated, at least within the class definitions, since the edges were used to look up the edge_ids every time.
  • I added lots more type checking to the class constructors and methods, to cut down on ambiguity (especially around the _edge_list dicts, may rename that later)
  • edge_metadata is typechecked to ensure only lists of dictionaries are allowed, no sets, dicts, or anything else like before. that way, the IHypergraph constructor can reliably map them to dicts of type Dict[Tuple, Dict].

added metadata field to DirectedHypergraph class
fixed logic bug in check_node()
switched get_nodes() to access node metadata in a more standardized fashion
still getting 34 failed tests due to TypeErrors and unwrapped edges
moved _canon_edge() implementation to i_undirected_graph from i_hypergraph
fixed parameters in set_attr_to_edge_metadata, remove_attr_from_edge_metadata in i_hypergraph
made a seperate _canon_edge method for directed_hypergraph
re-tested to ensure clean starting state before interface reintegration
implemented abstract methods for each class
Refactored TemporalHypergraph to inherit from IHypergraph instead of IUndirectedHypergraph

streamlined node and edge management
improved type annotations
reorganized methods for clarity and maintainability.
updated temporal-specific methods, metadata handling, serialization support, and utility functions.
removed redundant code and improved docstrings for better usability.
delegated more logic to the IHypergraph
consolidated node and edge management
improving metadata handling,
reorganizing utility and analysis methods.
removed redundant methods
docstrings were updated for consistency

just need to debug hashing tests
Standardize edge metadata storage to use edge keys instead of edge IDs across IHypergraph and all derived classes.
Update method signatures and internal logic for edge addition, removal, and metadata access to ensure consistent handling of edge metadata.
Improve type annotations and initialization for edge-related attributes.
Almost fully functionaly
Refactored the Hypergraph class to inherit from IUndirectedHypergraph
Abstract methods for edge and node management are now implemented in Hypergraph, and shared methods such as adjacency, neighbor, and weight management are centralized in the base class.
This improves code maintainability and reduces duplication across undirected hypergraph implementations.
@FraLotito FraLotito self-assigned this Jul 28, 2025
@FraLotito
Copy link
Contributor

This looks very useful! Thanks a lot for working on it, it is very needed. I'll take some time to review the code (may be slow due to holidays) and reach out for further questions / merge the code:)

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.

2 participants