Ooops. You're right. Drop the quotes. For 1.6:
query = neo4j.CypherQuery(
graph_db,
"""MATCH (m:Page {node:{*n1*}}), (n:Page {node:{*n2*}}),
p = shortestPath((m)-[*..20]->(n)) RETURN p"""
)
query.execute(*n1*=node1, *n2*=node2)
And for 2.0:
graph_db.cypher.execute(
"""MATCH (m:Pa
But the syntax is not correct, or?
MATCH (m:Page {node:'{*n1*}'}), (n:Page {node:'{*n2*}'})
-> remove the single quotes around the parameters.
On Sun, Nov 23, 2014 at 10:54 PM, Nigel Small
wrote:
> Following on from Michael's reply: in py2neo 1.6, you can pass parameters
> like this:
>
> que
Following on from Michael's reply: in py2neo 1.6, you can pass parameters
like this:
query = neo4j.CypherQuery(
graph_db,
"""MATCH (m:Page {node:'{*n1*}'}), (n:Page {node:'{*n2*}'}),
p = shortestPath((m)-[*..20]->(n)) RETURN p"""
)
query.execute(*n1*=node1, *n2*=node2)
In py2neo 2.0,
After adding the constraint / index, did you also change your query to
include the :Page label?
CREATE CONSTRAINT ON (p:Page) ASSERT p.node IS UNIQUE;
query = neo4j.CypherQuery(
graph_db,
"""MATCH (m:Page {node:'%s'}), (n:Page {node:'%s'}), p =
shortestPath((m)-[*..20]->(n)) RETURN p"
Sure it is simple in the Java API as you have full control, via
PathExpanders and Evaluators, see here:
http://neo4j.com/docs/stable/tutorials-java-embedded-graph-algo.html
http://neo4j.com/docs/stable/tutorials-java-embedded-traversal.html#examples-uniqueness-of-paths-in-traversals
Michael
On S
Hi Michael and Gabriel,
Is it possible to make such similar queries using Java API ? or the
graphAlgorithms ?, in the last case I understood that you can only use the
parameters: node and distance.
I would like to find all paths starting in one node, and exclude all paths
that have a node with t
>
>
> Thank you for your suggestions. The database is about 5.5G on disk.
I turned off auto indexing and applied the constraint on node id, but saw
no discernible difference in response time. Perhaps the culprit is the
pathfinding algorithm?
When I ask for the shortest path between two nodes t
Hi Michael,
Haha, true.
The statement in the manual is for the core (Java) API, we're currently
working on making that kind of performance available through cypher too.
Just a few questions:
* can you share your graph.db/messages.log for diagnostics on config.
* do you run your queries in the
Hi (or should I already say "Hi Michael Hunger" because you seem to answer
most questions),
We currently maintain a "directed acyclic graph" in SQL databases (the
usual products). For large graphs traversing is a problem. A typical
question is "Tell me all nodes with a certain property that hav