STAG C++  1.2.0
Spectral Toolkit of Algorithms for Graphs
Loading...
Searching...
No Matches
graph.h File Reference

Description

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

Typedefs

typedef long long stag_int
 
typedef Eigen::SparseMatrix< double, Eigen::ColMajor, stag_intSprsMat
 
typedef Eigen::MatrixXd DenseMat
 
typedef Eigen::Triplet< double, stag_intEdgeTriplet
 

Functions

stag::Graph stag::cycle_graph (stag_int n)
 
stag::Graph stag::complete_graph (stag_int n)
 
stag::Graph stag::barbell_graph (stag_int n)
 
stag::Graph stag::star_graph (stag_int n)
 

Typedef Documentation

◆ stag_int

typedef long long stag_int

The integer type used throughout the library.

◆ SprsMat

typedef Eigen::SparseMatrix<double, Eigen::ColMajor, stag_int> SprsMat

The fundamental datatype used in this library is the sparse matrix. We use the Eigen::SparseMatrix class in column-major format.

◆ DenseMat

typedef Eigen::MatrixXd DenseMat

Occasionally, it is more efficient to use a dense matrix, such as when the matrix is very small.

In this case, we use the Eigen::MatrixXd class.

◆ EdgeTriplet

typedef Eigen::Triplet<double, stag_int> EdgeTriplet

An Eigen::Triplet representing an edge in a graph. Stores the row, column, and value of an entry in a graph adjacency matrix.

Function Documentation

◆ cycle_graph()

stag::Graph stag::cycle_graph ( stag_int  n)

Construct a cycle graph on n vertices.

Parameters
nthe number of vertices in the constructed graph
Returns
a stag::Graph object representing a cycle graph

◆ complete_graph()

stag::Graph stag::complete_graph ( stag_int  n)

Construct a complete graph on n vertices.

Parameters
nthe number of vertices in the constructed graph
Returns
a stag::Graph object representing a complete graph

◆ barbell_graph()

stag::Graph stag::barbell_graph ( stag_int  n)

Construct a barbell graph. The barbell graph consists of 2 cliques on n vertices, connected by a single edge.

Parameters
nthe number of vertices in each of the two cliques. The returned graph will have \(2n\) vertices.
Returns
a stag::Graph object representing the barbell graph

◆ star_graph()

stag::Graph stag::star_graph ( stag_int  n)

Construct a star graph. The star graph consists of one central vertex connected by an edge to n-1 outer vertices.

Parameters
nthe number of vertices in the constructed graph
Returns
a stag::Graph object representing the star graph