C# shortest path algorithm source code