Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Find longest path over 2 relationship types

Node Link

I've followed the following guide to find a longest path when a single relationship is at play

However my model, of DNS resolution, looks like the following:


Any host outside of our DNS is the final destination e.g. a heroku app or S3 bucket.

I want to write a query that, given a host, traverses as far as the final host that does not have an ALIAS_FOR relationship.

There is the simple case of non-bifurcating chains, but there is also the bifurcating case to consider (for geo-specific DNS routing a host may be an alias for multiple DNSRecords).

As a nice to have, it'd be good if it could handle chains of length 1 (i.e. the Host provided has no ALIAS_FOR relationship)

The only way of tackling this problem I can think of is APOC virtual relationships, but I wonder if there is a native cypher way?