https://github.com/karanraj06/graph-template-library
Graph library that defines container template classes to study graphs and related algorithms in C++
https://github.com/karanraj06/graph-template-library
cpp graph-algorithms graphs
Last synced: 11 months ago
JSON representation
Graph library that defines container template classes to study graphs and related algorithms in C++
- Host: GitHub
- URL: https://github.com/karanraj06/graph-template-library
- Owner: Karanraj06
- Created: 2022-10-30T10:58:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-31T14:03:41.000Z (about 3 years ago)
- Last Synced: 2025-06-23T18:08:16.757Z (about 1 year ago)
- Topics: cpp, graph-algorithms, graphs
- Language: C++
- Homepage:
- Size: 651 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Graph-Template-Library
Defines container template classes to study graphs in C++
# Summary
- Graph template library to study graphs in C++
- Generic graph library
- Defines several container template classes
- Data structures for graphs, digraphs and weighted graphs
- Many standard graph algorithms
- Nodes can be arbitrary objects
# Example
Finds number of connected components in an undirected graph
```cpp
#include
#include "graph.h"
int main() {
graph g;
g.add_edge('a', 'b');
g.add_edge('c', 'd');
g.add_edge('d', 'e');
g.add_edge('f', 'g');
std::cout << "Number of connected components in g are " << g.number_of_connected_components() << "\n";
return 0;
}
```
Output
```
Number of connected components in g are 3
```