Sure, this should clear things up:

MATCH p = (n)-[r]->() RETURN COUNT(r)

94

This is equivalent to the count of all distinct relationships in your graph (assuming this is the entire query, nothing before this).

MATCH (n)-[r]-() RETURN COUNT(r)

188

All relationships in Neo4j are directed. When you leave off the direction, then a path can be matched from either direction. This means the `n`

here can either be the starting node of the relationship (where it comes from) or the end node of the relationship (where it points to), so each relationship will therefore be counted twice (94 * 2 = 188). If you wanted to get the number of distinct relationships instead, still leaving out the direction, you could do `RETURN count(DISTINCT r)`

instead. Another thing to remember is that paths in Neo4j are ordered. Even if the two nodes and single relationship are the same, the difference in the ordering of the nodes makes them distinct paths.

MATCH p = (n)-[r:property*]->() RETURN COUNT(r)

113288

This is a variable-length pattern, meaning it will match to paths of any and all lengths (minimum of 1) provided all relationships are outgoing :property relationships. In this case `r`

isn't referring to a single relationship, but rather a collection of relationships per path. `COUNT(r)`

in this case is not counting relationships, but counting the collection of relationships (not the size of the collection) per path, and since there is only one collection of relationships per path, this is the same as `COUNT(n)`

or `COUNT(p)`

or `COUNT(*)`

, and in all these cases will be returning you the number of paths found that match the pattern.