aplbrain/grand-cypher

Graph mutations?

j6k4m8 opened this issue · 5 comments

Graph mutations (updating, deleting, and creating vertices using Cypher) are a big engineering change, and will likely require a lot of corner-case tests.

I previously listed this as a "not-planned" feature but I wonder if users are interested in this capability existing? Perhaps @khoale88, I wonder what your current use-cases look like? I would be interested in adding this feature back into the roadmap if it will be useful!

It's really nice to have graph mutation. It can be done in the future as long as I can keep up the interest:)). I think it's better for the time being to focus on graph exploration by adding aggregation keywords.

Anw, your repo is hard to find on Google. Some keywords like python, networkx, cypher, neo4j ain't enough. I think some SEO techniques may work, or an article, medium perhaps, can help to promote the work and attract more contributors. What do you think?

It can be done in the future as long as I can keep up the interest:)). I think it's better for the time being to focus on graph exploration by adding aggregation keywords.

Super awesome :) I totally agree!

I think some SEO techniques may work, or an article, medium perhaps, can help to promote the work and attract more contributors. What do you think?

Definitely! I haven't had the time before to write anything about this tool, but I would love to write something; are you interested in writing something? Maybe we can write a post together?

Definitely! I haven't had the time before to write anything about this tool, but I would love to write something; are you Interested in writing something? Maybe we can write a post together?

I'm not good at writing though, but I can try. We can wait a little more for a better MVP or we can start with something that works first.

I see this thread has gone silent.. does this mean that I'd need to do a complete rebuild of my graph in order to handle mutations?

hey @dustyatx! We definitely don't require a rebuild of the graph to handle mutations; we just don't support it in the Cypher implementation yet (though I'd say it's still on the roadmap!).

For example, this works:

#!pip3 install grand-cypher networkx
import networkx as nx
from grandcypher import GrandCypher

# Create the network:
network = nx.DiGraph()
network.add_edge("A", "B")
network.add_node("A", username="@j6k4m8")
network.add_node("B", username="@dustyatx")

# Run a query:
print(GrandCypher(network).run("""
MATCH (A)-[]->(B)
RETURN A.username, B.username
"""))

# Mutate the graph using the underlying library:
network.add_node("C", username="@khoale88")
network.add_edge("A", "C")

# Rerun the query, no rematerialization required:
print(GrandCypher(network).run("""
MATCH (A)-[]->(B)
RETURN A.username, B.username
"""))