|
| void | load_graph (const std::string &filepath) |
| | Loads an edge list from a file into an adjacency list.
|
| |
| const std::vector< int > & | get_neighbors (int node) const |
| | Gets the neighbors of a given node.
|
| |
| void | add_node (int node) |
| | Adds a node to the graph.
|
| |
| void | delete_node (int node) |
| | Deletes a node and its edges from the graph.
|
| |
| void | save_graph (const std::string &filename) const |
| | Save the graph to a file in edge list format.
|
| |
◆ add_node()
| void Graph::add_node |
( |
int |
node | ) |
|
Adds a node to the graph.
- Parameters
-
◆ delete_node()
| void Graph::delete_node |
( |
int |
node | ) |
|
Deletes a node and its edges from the graph.
- Parameters
-
◆ get_neighbors()
| const std::vector< int > & Graph::get_neighbors |
( |
int |
node | ) |
const |
Gets the neighbors of a given node.
- Parameters
-
- Returns
- A const reference to a vector of neighbor node IDs.
◆ load_graph()
| void Graph::load_graph |
( |
const std::string & |
filepath | ) |
|
Loads an edge list from a file into an adjacency list.
- Parameters
-
| filepath | Path to the edge list file. |
◆ save_graph()
| void Graph::save_graph |
( |
const std::string & |
filename | ) |
const |
Save the graph to a file in edge list format.
Each line in the file will represent an edge as "src dst". Duplicate and self-loop edges are avoided.
- Parameters
-
| filename | The destination file path to save the graph. |
The documentation for this class was generated from the following files: