How many paths are returned from your query? MATCH p = (n)-[*0..2]-(m) where id(n) = 103105 and id(m) = 1386672 return p, reduce(totProximity = 0, n IN relationships(p)| totProximity + n.proximity) AS pathProximity order by pathProximity DESC;
your index is on :Topic(name) ? MATCH p = (n:Topic)-[*0..2]-(m:Topic) where n.name = 'title-1' and m.name = 'title-2' return p, reduce(totProximity = 0, n IN relationships(p)| totProximity + n.proximity) AS pathProximity order by pathProximity DESC; Can you profile your queries? go to: http://localhost:7474/webadmin/#/console/ and enter: profile MATCH p = (n)-[*0..2]-(m) where id(n) = 103105 and id(m) = 1386672 return p, reduce(totProximity = 0, n IN relationships(p)| totProximity + n.proximity) AS pathProximity order by pathProximity DESC; and profile MATCH p = (n:Topic)-[*0..2]-(m:Topic) where n.name = 'title-1' and m.name = 'title-2' return p, reduce(totProximity = 0, n IN relationships(p)| totProximity + n.proximity) AS pathProximity order by pathProximity DESC; and share the results On Fri, Oct 3, 2014 at 11:43 PM, gg4u <[email protected]> wrote: > Hi, > > here my new answer, I got into this issue: > > I have a large weighted graph with only one schema index on nodes (Topic): > 4M topics and 100M rels. > > I wanted to find paths between two given nodes. > > I tried out with queries like this one: > since it is a weighted graph, I compute the weighted path between nodes as > the sum of its weight (I called weight 'proximity' here). > > Problem is, a query of this type, on such a large graph, tooks ages: > > Note that using an index, either directly the internal id, give same > responsive results > *Is there any way to speed up performance to reasonable production time?* > (lower than 1s ... it means 3 orders of magnitude ... ) > > MATCH (n) , (m), p = (n)-[*0..2]-(m) > where id(n) = 103105 and id(m) = 1386672 > with p, n, m > return p, reduce(totProximity = 0, n IN relationships(p)| totProximity + > n.proximity) AS pathProximity order by pathProximity DESC; > > *~1M ms !!! * > > > same as > MATCH (n:Topic) , (m:Topic), p = (n)-[*0..2]-(m) > where n.name = 'title-1' and id(m) = 'title-2' > with p, n, m > return p, reduce(totProximity = 0, n IN relationships(p)| totProximity + > n.proximity) AS pathProximity order by pathProximity DESC; > > *~2M ms !!! * > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
