start to cord chaining algorithm