Skip to content

Conversation

@tristan-f-r
Copy link

@tristan-f-r tristan-f-r commented Jul 2, 2025

This adds mixed hypergraphs, or hypergraphs that can have both directed and undirected hyperedges. For the internal representation, we keep all three star dicts (forward/backward star from directed hypergraphs, star from undirected hypergraphs) and use that to keep track (along with the membership of __frozen_nodes/__frozen_head/__frozen_tail) of what hyperedges are what.

Generally, since mixed_hypergraph.py shares a lot of code, we try to use the exact same naming scheme from the other two hypergraph implementations as much as possible.

This PR also fixes some documentation and function inconsistencies along the way. (Most notably, the introduction of trim_node to UndirectedHypergraph with associated tests).

For testing, while the main mixed hypergraph testing file is small, almost all of the tests in the undirected/directed hypergraph testing files have been modified to also be tested on mixed graphs.

Note: This does not implement any algorithms; only the data structure itself.

@tristan-f-r tristan-f-r changed the title feat: mixed hypergraphs Add mixed hypergraphs Jul 2, 2025
one could use the underlying directed/undirected hypergraph instead - we'll add utility functions to do just that.
@tristan-f-r tristan-f-r marked this pull request as ready for review July 7, 2025 15:57
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