tket
|
Abstract class for representing graphs. More...
#include <AbstractGraph.hpp>
Public Member Functions | |
AbstractGraph () | |
Construct an empty graph. | |
AbstractGraph (const std::vector< T > &nodes) | |
Construct from vector of nodes. | |
virtual bool | edge_exists (const T &node1, const T &node2) const =0 |
Check if an edge exists between two nodes. | |
bool | bidirectional_edge_exists (const T &node1, const T &node2) const |
Check if an edge exists between two nodes. | |
bool | node_exists (const T &node) const |
Check if a node exists. | |
const std::set< T > & | nodes () const |
Reference to the underlying node set. | |
std::vector< T > | get_all_nodes_vec () const |
All nodes as a vector. | |
unsigned | n_nodes () const |
Number of nodes. | |
virtual std::vector< Edge > | get_all_edges_vec () const =0 |
All edges as a vector. | |
virtual unsigned | get_distance (const T &node1, const T &node2) const =0 |
Graph distance between two nodes. | |
virtual unsigned | get_diameter ()=0 |
Diameter of graph. | |
virtual | ~AbstractGraph () |
Protected Types | |
using | Edge = std::pair< T, T > |
Protected Attributes | |
std::set< T > | nodes_ |
std::optional< unsigned > | diameter_ |
Abstract class for representing graphs.
T | type of nodes in the graph |
Definition at line 39 of file AbstractGraph.hpp.
|
protected |
Definition at line 43 of file AbstractGraph.hpp.
|
inline |
Construct an empty graph.
Definition at line 49 of file AbstractGraph.hpp.
|
inlineexplicit |
Construct from vector of nodes.
Definition at line 52 of file AbstractGraph.hpp.
|
inlinevirtual |
Definition at line 86 of file AbstractGraph.hpp.
|
inline |
Check if an edge exists between two nodes.
Definition at line 59 of file AbstractGraph.hpp.
|
pure virtual |
Check if an edge exists between two nodes.
Implemented in tket::graphs::CompleteGraph< T >, and tket::graphs::DirectedGraphBase< T >.
|
pure virtual |
All edges as a vector.
Implemented in tket::graphs::CompleteGraph< T >, tket::graphs::CompleteGraph< Node >, tket::graphs::DirectedGraphBase< T >, tket::graphs::DirectedGraphBase< Node >, and tket::graphs::DirectedGraphBase< Qubit >.
|
inline |
All nodes as a vector.
Definition at line 70 of file AbstractGraph.hpp.
|
pure virtual |
Diameter of graph.
Implemented in tket::graphs::CompleteGraph< T >, tket::graphs::CompleteGraph< Node >, tket::graphs::DirectedGraph< T >, tket::graphs::DirectedGraph< Node >, and tket::graphs::DirectedGraph< Qubit >.
|
pure virtual |
Graph distance between two nodes.
Implemented in tket::graphs::CompleteGraph< T >, tket::graphs::DirectedGraphBase< T >, and tket::graphs::DirectedGraph< T >.
|
inline |
Number of nodes.
Definition at line 75 of file AbstractGraph.hpp.
|
inline |
Check if a node exists.
Definition at line 64 of file AbstractGraph.hpp.
|
inline |
Reference to the underlying node set.
Definition at line 67 of file AbstractGraph.hpp.
|
protected |
Definition at line 45 of file AbstractGraph.hpp.
|
protected |
Definition at line 44 of file AbstractGraph.hpp.