Learning the Topology and Behavior of Discrete Dynamical Systems