Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-13-2022 04:42 AM - edited 07-13-2022 05:46 AM
A newbie in the space, could anybody see any way to improve this cypher performance?
07-13-2022 07:54 AM
Hi @kasparov112000 ,
All the heavy computational part of this query is in
@kasparov112000 wrote:optional match (tile)<-[*]-(l:Letter)
Couple of questions.
1. Why are you using the [*], don't you have at least a particular type of relationship/pattern in order to arrive to the :Letter?
2. Is your subgraph expansion stopping for every path on the first :Letter or is expecting to find another one after?
3. Is APOC installed on your db instance?
Regards
B
07-13-2022 09:36 AM
Yes APOC is installed. (tile)<-[*]-(l:Letter), I am trying to understand or learn, is there any query that may produce all the possible paths/patterns?
07-13-2022 10:40 AM
Well, it depends on your :Letter logic. How does your model look?
The way your query is defined, it will expand through every possible relationship (even if that means duplicating Nodes) and then filtering those with a ending node with a :Letter label.
Take a look into https://neo4j.com/labs/apoc/4.1/graph-querying/expand-subgraph/ . You may find a better way to this using the labelFilter properly.
Regards
07-13-2022 11:11 AM
Thanks for the assistance , below is the shape.
I tried using the apoc library, but does not seem to yield all the data:
07-13-2022 03:51 PM
Well @kasparov112000 , you don't seem too have any KNOWS relationships. On your example, which one is the tile? From tile to :LETTER , do you know anything about the relationship that are in the middle? Maybe the type and direction? That way you can specify them in order to avoid cycles.
All the sessions of the conference are now available online