Is there a relative root tree that you can use to approach openings e.g. if x is played, the optimal choice is to play y?. With obvious cut across moves to transpose?
E.g. my thoughts made me think of this clip from Person of Interest https://youtu.be/ttRuzAaAURA & it how it tracks an opening in chess.com e.g. against games on the database and how that adjusts the percentages.
Easiest examples of switching or transposing:
Set out to play the Vienna; black goes 2.Nc6 and then you go 3.f4 and play the Gambit instead of going 3.Bc4 (not sure if that works out better on an engine but I'm thinking as an example).
Other one I could think of - open with e4 trying to play the Vienna again, get c6 back & then play 2.d4 and switch to a Smith Morra (again not sure if that is better than 2.Nc3).
Is there some kind of approach or path for transposing or switching?