[ENHANCEMENT] Add subgraph functionalities
Hi, I am a user of Memgraph, it is a very cool project!
During my project I found that there is a missing user case in Memgraph, that is to create subgraph by defining nodes and edges. In addition, other algos, e.g. betweenness centrality, community detection, clustering algos should be able to applied on subgraphs.
Thank you!
@antoniofilipovic will add more details here since we are actually implementing the same/similar stuff under E130-MG-graph-projection-features -> @antoniofilipovic could you also create the epic draft PR?
@lingxuan9 do you just need subgraph projection or do you have to project transitive relations, in other words, create additional edges based on the existing edges and then run an algorithm on top of that?
Hey, hey Antonio here, working on the projection features. The project feature will enable users to operate on a subgraph in query modules. The subgraph is projected from paths. It looks as follows:
MATCH p=(n:Person)-[e:Knows]->(m:FootballPlayer)
WITH project(p) AS graph
CALL page_rank.get(graph, ...) YIELD node, rank
RETURN *;
With this query, it is only possible to operate on subgraph containing edges already existing in the graph. PR for this feature is currently under the review phase. You can check it out here.
The transitive project feature should enable user to operate on a subgraph containing nodes and virtual (not real, don't exist in storage) edges.
MATCH p=(n1:Person)-[e1:Knows {}]->(m:FootballPlayer)<-[e2:Knows {}]-(n2:Person)
WITH project_transitive(n1, n2, 'KNOW_SAME_FOOTBALL_PLAYER', {new_edge_prop:..}) AS projected_graph
CALL page_rank.get(projected_graph, ...) YIELD node, rank
RETURN node, rank;
Let me know what is exactly you need.
@gitbuda @antoniofilipovic Thanks for reply!
The projection features work for my current requests for subgraph.
For transitive project feature, it looks very interesting, virtual edges means edges created by users, but not stored in database? Is it possible for this feature also works for virtual nodes or virtually delete nodes/edges?
No problem. Glad I can help!
Yes, virtual edges mean edges created by users but not stored in the database. That is what this term means to us.
Could you maybe provide an example of what is that you need, with virtual nodes? And also what does the term "virtually delete nodes/edges" mean to you?
Could you maybe provide an example of what is that you need, with virtual nodes? And also what does the term "virtually delete nodes/edges" mean to you?
For example, users can create subgraphs by creating nodes or deleting nodes/edges, but without actually changing the graph in storage.
Hey, if you haven't noticed, Memgraph 2.4. is out, and with it also has subgraph functionality. If that is cool for now, I will close this issue since it is solved. If you would on the other hand like us to implement anything else, please let us know on memgraph/memgraph.
Thanks for your work, the issue can be closed.