I'm trying to understand exactly how Cypher returns undirected paths. Here are two queries and their results (they are the same except one uses an undirected pattern):
MATCH path = (a)-[]->(b) RETURN count(path), count(distinct(path))
count(path):1236951
count(distinct(path)):1236951
MATCH path = (a)-[]-(b) RETURN count(path), count(distinct(path))
count(path):2473901
count(distinct(path)):2473901
I have two specific questions about this.
a.) Why is count(path) in the undirected case not exactly twice what it is in the directed case (it's off by 1)?
b.) In the undirected case, why is count(distinct(path)) the same as count(path)? I would have expected Cypher to match each path twice, once in each direction, and then not count the duplicates in count(distinct(path)). Is it not counting the two directions as the same path?