We introduce a cellular automaton model coupled with a transport equation for flows on graphs. The direction of the flow is described by a switching process where the switching probability dynamically changes according to the value of the transported quantity in the neighboring cells. A motivation is pedestrian dynamics during panic situations in a small corridor where the propagation of people in a part of the corridor can be either left- or right-going. Under the assumptions of propagation of chaos and mean-field limit, we derive a master equation and the corresponding mean-field kinetic and macroscopic models. Steady-states are computed and analyzed and exhibit the possibility of multiple metastable states and hysteresis. © 2014 Society for Industrial and Applied Mathematics.