I have a directed graph $G=(V,E)$ where each vertex is a 4-D coordinate $v: (x, y, z, c)$ representing spatial coordinates $x, y, z \in \mathbb{R}$ and the non-physical parameter colour $c \in (c_{1}, c_{2},... c_{n})$. The edge weights $\omega_{v_{a} \to v_{b}}: f(x, y, z)$ are purely a function of three of the four dimensions, as this is a physical problem.
Trouble is, I wish to find the shortest path given a specific sequence of colors (eg. $c_{2}, c_{5}, c_{1}, c_{1}, c_{3}, c_{4}$). It's difficult to incorporate this into the weight function as it is non-physical. Are there well-established path traversal algorithms that find the shortest path through coloured vertices, given the starting vertex, ending vertex, and the sequence it needs to pass through? I wonder if there is already a family of algorithms that describe this problem?
I've considered something like a Hidden Markov Model that abstracts vertices of colours into hidden states, but I am not sure how to prevent one state from being visited again (whereas in a directed acyclic graph I can prevent revisiting the same vertex).