![]() |
STAG C++
2.0.0
Spectral Toolkit of Algorithms for Graphs
|
Core graph class definitions and constructors.
Classes | |
struct | stag::edge |
A structure representing a weighted edge in a graph. More... | |
class | stag::LocalGraph |
An abstract class which defines methods for exploring the local neighborhood of vertices in a graph. More... | |
class | stag::Graph |
The core object used to represent graphs for use with the library. More... | |
class | stag::AdjacencyListLocalGraph |
A local graph backed by an adjacency list file on disk. More... | |
Functions | |
stag::Graph | stag::cycle_graph (StagInt n) |
stag::Graph | stag::complete_graph (StagInt n) |
stag::Graph | stag::barbell_graph (StagInt n) |
stag::Graph | stag::star_graph (StagInt n) |
stag::Graph | stag::identity_graph (StagInt n) |
template<typename Scalar > | |
stag::Graph | stag::operator* (Scalar lhs, const stag::Graph &rhs) |
template<typename Scalar > | |
stag::Graph | stag::operator* (const stag::Graph &lhs, Scalar rhs) |
stag::Graph | stag::operator+ (const stag::Graph &lhs, const stag::Graph &rhs) |
stag::Graph stag::cycle_graph | ( | StagInt | n | ) |
Construct a cycle graph on n vertices.
n | the number of vertices in the constructed graph |
stag::Graph stag::complete_graph | ( | StagInt | n | ) |
Construct a complete graph on n vertices.
n | the number of vertices in the constructed graph |
stag::Graph stag::barbell_graph | ( | StagInt | n | ) |
Construct a barbell graph. The barbell graph consists of 2 cliques on n vertices, connected by a single edge.
n | the number of vertices in each of the two cliques. The returned graph will have \(2n\) vertices. |
stag::Graph stag::star_graph | ( | StagInt | n | ) |
Construct a star graph. The star graph consists of one central vertex connected by an edge to n-1 outer vertices.
n | the number of vertices in the constructed graph |
stag::Graph stag::identity_graph | ( | StagInt | n | ) |
Construct the 'identity graph'. The identity graph consists of \(n\) vertices, each with a self-loop of weight 1.
Both the adjacency matrix and Laplacian matrix of the identity graph are equal to the identity matrix.
n | the number of vertices in the constructed graph |
stag::Graph stag::operator* | ( | Scalar | lhs, |
const stag::Graph & | rhs | ||
) |
Multiplying a graph by a scalar is equivalent to multiplying the weight of each edge by the given value.
For example, the following code creates a complete graph with edges of weight 2.
stag::Graph stag::operator* | ( | const stag::Graph & | lhs, |
Scalar | rhs | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
stag::Graph stag::operator+ | ( | const stag::Graph & | lhs, |
const stag::Graph & | rhs | ||
) |
Adding two graphs is equivalent to adding their adjacency matrices.
The graphs must have the same number of vertices. For example, the following code adds a complete graph and a cycle graph on \(5\) vertices.
std::invalud_argument | if the graphs have different sizes. |