Hacker News new | past | comments | ask | show | jobs | submit | yamafaktory's comments login

Author here - I'm not using pointers in my implementation but indexes as you mentioned.


It was initially called HyperZig but after talking with some "ziguanas", using the exact word "hypergraph" in the same felt more accurate.


I'm honestly not sure if I can answer that question. There's plenty of applications for hypergraphs (e.g. https://www.sciencedirect.com/science/article/pii/S209580992...), so I'd say why not?


Are you implementing this to solve any particular application?


Not really - yet. I made that as an exercise to learn some Zig and to see how fast/efficient it might be.


Internally both the hyperedges and the vertices are stored as an AutoArrayHashmap with the associated data and the relations ( https://github.com/yamafaktory/hypergraphz/blob/9f87e705afd7...). Then the implementation diverge since a given hyperedge can hold zero to n vertices, with self-loops (ArrayList). For vertices, we just need to keep track of the hyperedges (AutoArrayHashmap).


Thanks for the feedback! Developing/prototyping is a very pleasant experience in Zig compared to Rust. It's obviously a different approach and some might find the tooling less mature but I quickly realized that the build system (as per 0.13.0) is very solid. You can build the docs, run the tests, etc. I'm a Neovim user and honestly the LSP (ZLS) is stable and you can additionally get the compilation errors (you need to create a check step in your build file). In tests, using with the testing allocator to catch memory leaks guides you while prototyping.


Thanks!


What triggers the initial willingness to implement something with hypergraphs was indeed the Wolfram physics project! https://github.com/yamafaktory/hypergraph/discussions/11#dis...


Social media for example.


Maybe companies like Facebook modeled their "social graph" with hypergraphs?


Great, thanks! It does seem like they might be using something like this for social graph. Somebody gave neat explanation on Quora [1]

[1] https://www.quora.com/How-has-Facebook-modeled-its-social-gr...


Thanks a ton for the feedback!

You're right maybe the wording is wrong: query more than manipulate. By the way, querying like jq might be an interesting new feature. Don't know exactly in which direction it should go / what it should do / how exactly it should look like (grammar)

N.B.: I have another project called jql which is actually a simpler - and faster - jq made with Rust https://github.com/yamafaktory/jql


Wow that’s awesome you actually have a jq like implementation. Hmmm since it’s a graph maybe you could go with something like openCypher [0] or GQL [1] (possibly gremlin too) or maybe you could even query it with GraphQL (although GraphQL only traverses down in a tree fashion)? Although some sort of simpler jq like syntax might be able to make more sense. It would need to be able to branch out somehow. I think even an emmet [2] like syntax might work well.

[0]: http://www.jcc.com/resources/jcc-blogs-menu/blog-database-dr...

[1]: https://www.gqlstandards.org/gql-blogs

[2]: https://docs.emmet.io/cheat-sheet/


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: