A time expanded network based algorithm for safe and efficient distributed multi-agent coordination