Problems with responde of cypher-pattern-varlength like (a)-[[:KNOWS*1..3]]->(b)

Hello

I have read through the following post, but do not quite understand the response i get in the example ..

also from the article above
GRaph_example

when i do

(a)-[[:KNOWS*1..3]]->(b)
WHERE a.name = 'Anders'
return a.name, b.name

I get as result

  • "Anders" "Dilshad"
  • "Anders" "Cesar"
  • "Anders" "Becky"
  • "Anders" "Filipa"
  • "Anders" "George"

what I need (would like to have) is

  • "Anders" "Dilshad"
  • "Anders" "Cesar"
  • "Anders" "Becky"
  • "Dilshad" "Filipa"
  • "Cesar" "George"
  • "Becky" "George"

any simple solution for that?
Thanks rob

The query means "Who does Anders know directly or indirectly (with up to 3 jumps)"

The query you might be wanting is "who knows who directly).

That would be:

(a)-[[:KNOWS]]->(b)
return a.name, b.name  // this will have duplicates though, which could be removed with sorting and distinct.

Or maybe you mean "who know who within 3 hops of Anders"

Then I think it would be something like except it wouldn't include people directly associated with Anders. (I can't quite figure out a neat short query for that....)

(a)-[[:KNOWS*1..3]]->(someone_in_anders_circle)
WHERE a.name = 'Anders'
MATCH (someone_in_anders_circle)-[:KNOWS]->(b)