Implementation of Dijkstra's algorithm using custom graph API.