Linear switched dynamical systems on graphs