General Implementation of Dijkstra's algorithm to a generic discrete graph