I've found that Zig is an excellent tool for implementing data-structure-oriented libraries. Comptime genericity is simple to understand and use, providing a C interface is very easy, and libraries take an allocator, so any memory-safety issues are the consumer's problem. If you want to use it from a memory-safe language, well, all of those have C FFIs so far as I know, Rust very much included, so you can.
A hypergraph is clearly a data structure which demands a lot of cyclic references, no getting around that, so I'm curious: can you compare and contrast the experience of implementing this in Rust vs. Zig?
Does it? The easiest data structure is a 2d array with rows corresponding to nodes and columns corresponding to edges. If nodes aren't allowed to touch an edge more than once, it's just a matrix of bools. No references needed!
But yes, a hypergraph will have a lot of vertices referencing each other along (hyper)edges, however you choose to implement it. These can, and often do, form cycles, so again, no matter how the implementation is constructed, it has to handle that.
You'll have to check out the source for details on how this one is implemented, I wouldn't dream of spoiling the fun.
No, this is simply not true. A pair of integers indexing into a matrix does not require a reference to anything except for one to the container. Hypergraphs are equivalent to bipartite graphs through the incidence matrix construction. Vertices simply do not need to reference one another.
I'm speaking as a seasoned graph theorist who has been using zig and rust for about as long as zig has existed. Your implementation has some nice features but it is far from the only way of doing things.