gds.run_cypher() on a projected graph

110 Views Asked by At

How do I query my projected graph? Ideally, I want to be able to do this:

# We put this simple graph in our database
gds.run_cypher(
  """
  CREATE
    (m: City {name: "Malmö"}),
    (l: City {name: "London"}),
    (s: City {name: "San Mateo"}),

    (m)-[:FLY_TO]->(l),
    (l)-[:FLY_TO]->(m),
    (l)-[:FLY_TO]->(s),
    (s)-[:FLY_TO]->(l)
  """
)

# We estimate required memory of the operation
res = gds.graph.project.estimate(
    ["City"],                   #  Node projection
    "FLY_TO",                   #  Relationship projection
    readConcurrency=4           #  Configuration parameters
)
assert res["bytesMax"] < 1e12

G, result = gds.graph.project(
    "offices",                  #  Graph name
    ["City"],                   #  Node projection
    "FLY_TO",                   #  Relationship projection
    readConcurrency=4           #  Configuration parameters
)

res = gds.run_cypher(<some cypher on G>)

According to GDS documentation, it looks like I need to use gds.alpha.create.cypherdb(), but I only have read-only access.

What is a good way to run cypher queries on a projected graph? The other methods have the mutate mode where it takes in the projected graph object as an argument, but I don't see such documentation for just running cypher via run_cypher().

0

There are 0 best solutions below