Although Amazon does not offer a way to run Neptune locally, Apache Gremlin Server is a close enough approximation for testing and development purposes.
In many cases, Gremlin queries that are deadlocked can be retried automatically. But in order for retries to work reliably, queries need to be idempotent.