I created the following graph to model a transit network, where stops are connected to other stops via service nodes (service nodes define specific days of service). The relationships have distinct types and properties. Specifically GOES_TO relationships have an id property which identifies a trip (e.g. bus) travelling between the stops.
I wish to find the shortest path with the minimum number of distinct id values among all :GOES_TO relationships on the path.
In the case above, the shortest path should be:
(A)-[:USES]-(1:Service)-[:GOES_TO {id:7}]->(B)-[:USES]-(2:Service)-[:GOES_TO {id:7}]->(D)
This path uses a single id:7 to get from A to D.
Note that the condition applies only for :GOES_TO relationships. :USES relationships do not have and id property at all.
I have tried several approaches but cannot seem to get this seemingly simple problem resolved with cypher.