Mapping dynamics into graphs