I need to extract a subgraph (a subset of nodes and edges) based on a user defined conditions such as attributes values and labels. This is already feasible using either a query language such as cypher or gremlin, or simply coded using a java methods.
However, since I'm dealing with large graphs, I wish to keep the extracted subgraph for further querying, and even iterate the subextraction-querying process.
I've seen these discussions : Extract subgraph in neo4j , Extracting subgraph from neo4j database. However, I couldn't figure out the answer for my case.
I was thinking of some alternatives :
- Building a new index each time I need to extract a subgraph
- Use a cache to store the nodes/edges which might be useful for arithmetic computation such as average etc.
- Create a new instance of embedded ne4j, however this is really costly !
Another point, is getByID cheaper than index lookup. I know this depends on the case: large graphs or small index ...