An open API service indexing awesome lists of open source software.

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++

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
```