alternative to path and a* algo