I'm using the common.graph
from Google Guava in Version 21.0. It suits very well to my usecase without one aspect: Persistence. The graph seems to be in-memory only. The graph-classes does not implement Serializable
, it was explained in this issue posts.
Google describes three models to store the topology. The third option is:
a separate data repository (for example, a database) stores the topology
But that's all. I didn't found any methods in the package to apply a separate data repository. Is there any way to do this? Or is the only way to use the nodes()
and edges()
method to get a Set
of my nodes and a Set
of my edges? I can persist them in a database if I implement Serializable
in this classes and restore the graph by calling addNode(Node)
and addEdge(Source, Target, Edge)
(there are no addAll-methods). But this seems to be a workaround.
Thanks for your support!