A Graph data structure
This library provides a minimal implementation of a directed/weighted graph data structure. Internally, an adjacency list is used to represent nodes and edges.
Description: Wiki
A graph is a structure amounting to a set of objects in which some pairs of the objects are in some sense "related". There are two main parts of a graph:
- The nodes (vertices) where the data is stored i.e. the numbers in the image
- The edges (connections) which connect the nodes i.e. the lines between the numbers in the image
Graphs can be directed or undirected
- Directed graph: The relationships are based on the direction of the edges. It can be a one way relationship or a two-way relationship, but it must be explicitly stated.
- Undirected graph: The relationship exists in both directions. Can be represented via directed graph.
- Mother Node in a Graph: Info
- Number of paths between nodes: Info
- Is cyclic: Info
- Has negative cycle: Info
graph.serialize("fileName");
graph.deserialize("fileName");Serializes the graph to the file, deserialize from the file The following will be in the file
5
A 2
1 5 2 2
B 1
3 1
C 1
4 4
D 1
4 3
E 1
0 1
mkdir ./build
cd ./build
cmake ..
make -j <job count>
cd build/examples
./<example_name>
This project is licensed under the MIT License - see the LICENSE file for details
