tket
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Attributes | List of all members
tket::graphs::AbstractGraph< T > Class Template Referenceabstract

Abstract class for representing graphs. More...

#include <AbstractGraph.hpp>

Inheritance diagram for tket::graphs::AbstractGraph< T >:
Inheritance graph
[legend]
Collaboration diagram for tket::graphs::AbstractGraph< T >:
Collaboration graph
[legend]

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< Tget_all_nodes_vec () const
 All nodes as a vector.
 
unsigned n_nodes () const
 Number of nodes.
 
virtual std::vector< Edgeget_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< Tnodes_
 
std::optional< unsigned > diameter_
 

Detailed Description

template<typename T>
class tket::graphs::AbstractGraph< T >

Abstract class for representing graphs.

Template Parameters
Ttype of nodes in the graph

Definition at line 39 of file AbstractGraph.hpp.

Member Typedef Documentation

◆ Edge

template<typename T >
using tket::graphs::AbstractGraph< T >::Edge = std::pair<T, T>
protected

Definition at line 43 of file AbstractGraph.hpp.

Constructor & Destructor Documentation

◆ AbstractGraph() [1/2]

template<typename T >
tket::graphs::AbstractGraph< T >::AbstractGraph ( )
inline

Construct an empty graph.

Definition at line 49 of file AbstractGraph.hpp.

◆ AbstractGraph() [2/2]

template<typename T >
tket::graphs::AbstractGraph< T >::AbstractGraph ( const std::vector< T > &  nodes)
inlineexplicit

Construct from vector of nodes.

Definition at line 52 of file AbstractGraph.hpp.

◆ ~AbstractGraph()

template<typename T >
virtual tket::graphs::AbstractGraph< T >::~AbstractGraph ( )
inlinevirtual

Definition at line 86 of file AbstractGraph.hpp.

Member Function Documentation

◆ bidirectional_edge_exists()

template<typename T >
bool tket::graphs::AbstractGraph< T >::bidirectional_edge_exists ( const T node1,
const T node2 
) const
inline

Check if an edge exists between two nodes.

Definition at line 59 of file AbstractGraph.hpp.

◆ edge_exists()

template<typename T >
virtual bool tket::graphs::AbstractGraph< T >::edge_exists ( const T node1,
const T node2 
) const
pure virtual

Check if an edge exists between two nodes.

Implemented in tket::graphs::CompleteGraph< T >, and tket::graphs::DirectedGraphBase< T >.

◆ get_all_edges_vec()

template<typename T >
virtual std::vector< Edge > tket::graphs::AbstractGraph< T >::get_all_edges_vec ( ) const
pure virtual

◆ get_all_nodes_vec()

template<typename T >
std::vector< T > tket::graphs::AbstractGraph< T >::get_all_nodes_vec ( ) const
inline

All nodes as a vector.

Definition at line 70 of file AbstractGraph.hpp.

◆ get_diameter()

template<typename T >
virtual unsigned tket::graphs::AbstractGraph< T >::get_diameter ( )
pure virtual

◆ get_distance()

template<typename T >
virtual unsigned tket::graphs::AbstractGraph< T >::get_distance ( const T node1,
const T node2 
) const
pure virtual

◆ n_nodes()

template<typename T >
unsigned tket::graphs::AbstractGraph< T >::n_nodes ( ) const
inline

Number of nodes.

Definition at line 75 of file AbstractGraph.hpp.

◆ node_exists()

template<typename T >
bool tket::graphs::AbstractGraph< T >::node_exists ( const T node) const
inline

Check if a node exists.

Definition at line 64 of file AbstractGraph.hpp.

◆ nodes()

template<typename T >
const std::set< T > & tket::graphs::AbstractGraph< T >::nodes ( ) const
inline

Reference to the underlying node set.

Definition at line 67 of file AbstractGraph.hpp.

Member Data Documentation

◆ diameter_

template<typename T >
std::optional<unsigned> tket::graphs::AbstractGraph< T >::diameter_
protected

Definition at line 45 of file AbstractGraph.hpp.

◆ nodes_

template<typename T >
std::set<T> tket::graphs::AbstractGraph< T >::nodes_
protected

Definition at line 44 of file AbstractGraph.hpp.


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