As a bit of a learning project, I am working to replace a somewhat slow program in perl with a Chapel implementation. I've got the algorithms down, but I'm struggling with the best way to reference the data in Chapel. I can do a direct translation, but it seems likely I'm missing a better way.
Details of existing program:
- I have a graph with ~32000 nodes and ~2.1M edges. State is saved in data files, but it's run as a daemon that keeps data in memory.
- Each node has a numeric ID (assigned by another system) and have a variety of other attributes defined by string, integer, and boolean values.
- The edges are directional and have a couple of boolean values attributed to them.
- I have an external system that interacts with this daemon that I cannot change. It makes requests, such as "Add node (int) with these attributes", "find shortest path from node (int) to node (int)", or "add edges from node (int) to node(s) (int, int, int)"
In Perl, the program uses hashes with common integer IDs for node and edge attributes. I can certainly replicate this in Chapel with associative arrays.
Is there a better way to bundle this all together? I've been trying to wrap my head around ways to have opaque node and edge with each item defined, but struggling with how to reference them with the integer IDs in an easy fashion.
If somebody can provide an ideal way to do the following, it would get me the push I need.
- Create two nodes with xx attributes identified by integer ID.
- Create an edge between the two with xx attribues
- Respond to request "show me the xx attribute of node (int)"
Cheers, and thanks.