Class that represents a directed graph and provides methods for manipulating the graph.
More...
|
| Graph (int nodes) |
| Constructor for the Graph class.
|
|
void | addEdge (int u, int v) |
| Function that adds an edge between two nodes or vertices of graph.
|
|
const std::vector< std::vector< int > > & | getAdjacencyList () const |
| Get the adjacency list of the graph.
|
|
int | getNumNodes () const |
| Get the number of nodes in the graph.
|
|
|
int | n |
|
std::vector< std::vector< int > > | adj |
|
Class that represents a directed graph and provides methods for manipulating the graph.
Definition at line 38 of file topological_sort.cpp.
◆ Graph()
graph::topological_sort::Graph::Graph |
( |
int | nodes | ) |
|
|
inline |
Constructor for the Graph class.
- Parameters
-
nodes | Number of nodes in the graph |
Definition at line 48 of file topological_sort.cpp.
48: n(nodes), adj(nodes) {}
◆ addEdge()
void graph::topological_sort::Graph::addEdge |
( |
int | u, |
|
|
int | v ) |
|
inline |
Function that adds an edge between two nodes or vertices of graph.
- Parameters
-
u | Start node of the edge |
v | End node of the edge |
Definition at line 55 of file topological_sort.cpp.
55{ adj[u].push_back(v); }
◆ getAdjacencyList()
const std::vector< std::vector< int > > & graph::topological_sort::Graph::getAdjacencyList |
( |
| ) |
const |
|
inline |
Get the adjacency list of the graph.
- Returns
- A reference to the adjacency list
Definition at line 61 of file topological_sort.cpp.
◆ getNumNodes()
int graph::topological_sort::Graph::getNumNodes |
( |
| ) |
const |
|
inline |
Get the number of nodes in the graph.
- Returns
- The number of nodes
Definition at line 69 of file topological_sort.cpp.
◆ adj
std::vector<std::vector<int> > graph::topological_sort::Graph::adj |
|
private |
int graph::topological_sort::Graph::n |
|
private |
The documentation for this class was generated from the following file: