I need to create an algorithm that will define if a path between the value a and b are valid, my doubt is in relation to these rules, for example between node 3 and 7 there is a valid path, but between nodes 3 and 10 I would need to take a turn, does that still make it valid ?! and between nodes 1 and 7 there is also a valid path?!