Reputation: 703
I'm trying to store nodes of a graph in redis. My node is of type HashMap(String fromNode, HashMap(String toNode,Integer weight) ) How do I store such data structure in redis?
Upvotes: 0
Views: 353
Reputation: 879
At the moment RedisGraph requires UUID, please make sure UUID lib is installed on your system, to install run: apt-get install uuid-dev
Please let me know if resolved, Thank you.
Upvotes: 1
Reputation: 50062
If you're just interested in storing the data, any serialization to a String would do. If you want to query the data, first define the queries and then choose the data structure.
Intuitively, without familiarity with your requirements, I'd use a Sorted Set per fromNode, in which each member is a toNode and the score is set to its weight. That said, a graph implementation is far from trivial. As an alternative, check Redis Graph
- a Redis v4 module that implements a graph database with a Cypher-like querying language.
Upvotes: 2