https://github.com/v3ssel/graph_algorithms
Collection of graph algorithms. Graph is based on adjacency matrix.
https://github.com/v3ssel/graph_algorithms
ant-colony-algorithm bfs branches-and-bounds cpp dfs dijkstra-shortest-path floyd-warshall-algorithm genetic-algorithm prim-algorithm traveling-salesman-problem
Last synced: 2 months ago
JSON representation
Collection of graph algorithms. Graph is based on adjacency matrix.
- Host: GitHub
- URL: https://github.com/v3ssel/graph_algorithms
- Owner: v3ssel
- Created: 2024-03-29T07:20:52.000Z (about 1 year ago)
- Default Branch: develop
- Last Pushed: 2024-03-29T11:05:20.000Z (about 1 year ago)
- Last Synced: 2025-01-13T10:11:43.377Z (4 months ago)
- Topics: ant-colony-algorithm, bfs, branches-and-bounds, cpp, dfs, dijkstra-shortest-path, floyd-warshall-algorithm, genetic-algorithm, prim-algorithm, traveling-salesman-problem
- Language: C++
- Homepage:
- Size: 1.32 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Collection of Graph algorithms
Graph is implemented in adjacency matrix format, like:
```
SIZE
M A T
R I X
* * *
```
```
3
0 2 4
3 0 2
7 9 0
```
You can find example files in `src/assets` directory.# Collection list
For now there are 8 algorithms and some graph operations:In `graph.h` you can:
* Load graph from adjacency matrix
* Export graph as adjacency matrix
* Export graph in DOT formatIn `graph_algorithms.h` implemented:
* Depth First Search
* Bread First Search
* Dijkstra algorithm for finding shortest path.
* Floyd-Warshall algorithm for finding shortest path between all vertices.
* Prim algorithm for finding least spanning tree.And there are 3 traveling salesman problem solving algorithms in `src/graph/TSM` directory:
* Ant Colony Optimization algorithm
* Genetic Algorithm
* Branches and Bounds algorithm# Console Interface
In addition, there are implemented console interface.
For building use:
```
make install
```
or
```
cmake . -B build && \
cmake --build build --target GraphApplication --config=Release
```and launch:
```
./GraphApplication
```# Library
You can build a static library only.For building only graph, use:
```
make graph.a
```For build with algorithms, use:
```
make graph_algorithms.a
```Or you can use cmake directly, see `src/Makefile`
# Tests
There are some tests for these algorithms.
You can build and run them to check everything is fine.For building use:
```
make tests
```
or
```
cmake . -B build && \
cmake --build build --target GraphTests --config=Release
```and launch:
```
./GraphTests
```### Note: Tests using src/assets files, make sure they are not edited.