Learning Dynamics and Structure of Complex Systems Using Graph Neural Networks