aegisgraph
A high-performance, secure C++ graph library using adjacency lists
Loading...
Searching...
No Matches
Graph Class Reference

Public Member Functions

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.
 

Member Function Documentation

◆ add_node()

void Graph::add_node ( int  node)

Adds a node to the graph.

Parameters
nodeNode ID to add.

◆ delete_node()

void Graph::delete_node ( int  node)

Deletes a node and its edges from the graph.

Parameters
nodeNode ID to delete.

◆ get_neighbors()

const std::vector< int > & Graph::get_neighbors ( int  node) const

Gets the neighbors of a given node.

Parameters
nodeNode ID to query.
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
filepathPath 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
filenameThe destination file path to save the graph.

The documentation for this class was generated from the following files: