Implementation of simple algorithms of finding the shortest path in the graph and the best connection