Skip to content
Igor-Stovba edited this page Jan 25, 2025 · 2 revisions

Documentation of implemented algorithms

Dijkstra's algorithm

Description

There are 2 implementations of Dijsktra algorithm: low-, high-density. The weights SHOULD be non-negative. When the common structure of graph is rather well defined and clear, it is suitable to choose the correct mode.

Both algorithms accept start vertex (int), end vertex (int) and the graph in form of the adjacency list. It returns the pair of values: weight of the shortest path and the path itself.

The Bellman-Ford algorithm

Description

It solves the same problem as Dijkstra except that the weights can be negative, BUT there shouldn't be negative cycles.

The algorithm accepts start vertex (int) and the graph in form of the adjacency list. It returns the vector of shortest paths from start to all vertexes of the graph.

Johnson's algorithm

Description

It makes sense to use this algorithm only if you have negative weights (without negative cycles) and at the same time you should perform multiple queries. Then the algorithm calculates the Johnson's potentials and returns them.

In turn, the user can add these potentials to the initial graph and then invoke more efficient Dijkstra algorithms as much as needed.

search algorithm A*

Description

A* is a modified version of Dijkstra's algorithm, which can be more efficient for computing path to a one specific vertice. It needs heuristic function that estimates distance between two vertices and gives higher priority to the ones closer to target vertice.

The Floyd Warshall algorithm

Description

The Floyd Warshall algorithm computes distance from all to all and the paths can also be restored.

Lee's algorithm (wave algorithm)

Description

Lee's algorithm is actually just a version of bfs that explicitly stores "levels" of search and can only be used with unweighted graphs. Typically used for searching paths on a game map. Our implementation works for rectangular mazes defined by boolean arrays. You can also print the found path using print_maze_path.

Architectural documentation

Main components

  1. Converter - the class whose task is to convert between one graph's representation to another one. Supported representations:
  • // TODO
  1. Graph algorithms

Testing

Functional testing

//TODO

Benchmark testing

Google Benchmark and Boost Graph Library are used to do benchmark testing.