In TikZ, I am looking for a way to color segments of a single edge with different colors, like the edge aba->bbb in the picture below.
Any ideas?
For a presentation (I use the beamer package), I am trying to show how the edges of graph G^3 can be generated from the edges of G (see the definition in the picture) and thought this would be a good way. If you have any other ideas (possibly those that are easier to TeX), please tell me!
Best Answer
Second update
Now that I reread the question, here's a
tricolor
style; first the total length of the path is measured and then the three colors are applied to each third part of the path:The code:
Of course, tricolor can be used in a true three different color context:
The code:
Update
The same initial idea, but now using a style:
A simplistic possibility drawing the path twice, with the same
dash pattern
and differentdash phase
: