Arrangement of colored cars in traffic Seeing helicoptor captures of car packed streets, and the sort order of colors can be observed, if for simplicity we limit the scope of the pictures to say 9 or 10 cars, I wondered whether it is possible to count all the unique arrangements of the 9 colored cars in a line (assuming we have 4 blue and 5 green ones) where the order g..g..b..g..b can always be found in the arrangement. That is, an order involving only 5 cars is sought for out of the 9.

I have a feeling it is very similar to introductory problems in probability involving a bowl of colored balls, where we know how the bowl is composed, and we are asked how many arrangements of this and that color can be observed in order, if we pick a number of balls at a time.
The regular expression that describes the valid sequences of cars is:

b*g b*g g*b b*g g*b (g|b)*

being b "blue car", g "green car", "*" zero or more, "|" alternative and blanks are used only for explicitness.

That means we must initially solve two problems of integer partition with fixed number of parts (see here), one for blues, one for greens. 

For blue cars, we must find 4 parts that adds 2 cars (the remainder after subtract the two in mandatory positions to the four available) . The result is:
(0,0,0,2)
(0,0,1,1)
(0,0,2,0)
(0,1,0,1)
(0,1,1,1)
(0,2,0,0)
(1,0,0,1)
(1,0,1,0)
(1,1,0,0)
(2,0,0,0)

and 2 green cars in 3 parts:

(0,0,2)
(0,1,1)
(0,2,0)
(1,0,1)
(1,1,0)
(2,0,0)

Each pair of these two list of solutions defines a start of the sequence and the amount of green and blue cars that are available in the queue part "(b|g)*". This part has variants defined by the permutations with repetition $\frac{(m+n)!}{m!n!}$. By example:


(0,0,0,2) and (0,0,2) : ggbgb + pv{b,b,g,g}, with 4!/(2!2!)=6 alternatives (bbgg, bggb, bgbg, ....)
for the last item. 
(0,0,1,1) and (0,1,1) : ggbbggb + pv{b,g}, with
2!/(1!1!)=2 alternatives for the last item (bg and gb).
...


** Addendum ** 

If the sequence has fixed start (g) and end (b), just discard these two cars. The the problem is now:

b*g g*b b*g (g|b)*

with 3 b and 4 g available in total. Using same method:

Partition for b:
(0,0,2)
(0,1,1)
(0,2,0)
(1,0,1)
(1,1,0)
(2,0,0)

partition for g:
(0,2)
(1,1)
(2,0)

that means 18 starts where each one has ending variants :

(0,0,2) - (0,2) : 4!/(2!2!) = 6

(0,1,1) - (0,2) : 3!/(2!1!) = 3

(0,2,0) - (0,2) : ... = 1

(1,0,1) - (0,2) : ... = 3

(1,1,0) - (0,2) : ... = 1

(2,0,0) - (0,2) : ... = 1

(0,0,2) - (1,1) : ... = 3

(0,1,1) - (1,1) : ... = 2

(0,2,0) - (1,1) : ... = 1

(1,0,1) - (1,1) : ... = 2

(1,1,0) - (1,1) : ... = 1

(2,0,0) - (1,1) : ... = 1

(0,0,2) - (2,0) : ... = 1

(0,1,1) - (2,0) : ... = 1

(0,2,0) - (2,0) : ... = 1

(1,0,1) - (2,0) : ... = 1

(1,1,0) - (2,0) : ... = 1

(2,0,0) - (2,0) : ... = 1

total is 31.
Hint

Notice, that there are only 4 cases, when this sequence can not be found in line:


ABC, where A contains $a$ greens, B contains 4 blues, C contains $c$ greens ($a+c=5$)
ABCDE, where A contains $a$ greens, B contains b blues, C contains $c$ greens, D contains $d$ blues and E contains e greens($a+c+e=5$, $b+d=4$, $a\leq 1$, $b,c,d,e &gt;0$)
ABCDEF, where A contains $a$ blues, B contains 1 green, C contains $c$ blues, D contains $d$ greens and E contains e blues, F contains f greens($a+c+e=4$, $d+f=4$, $a,c,d,e,f&gt;0$)
ABCDEFG, where A, C, E, G contains 1 blues, B contains 1 green, D contains $d$ greens, F contains f greens( $d+f=4$, $d,f&gt;0$)


All these cases are disjoint and easy to calculate the number of possibilities.