Dynamic network analysis with applications to functional neural connectivity