Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Digraph< BaseGraph > Class Template Reference

Generic directed graph (digraph) wrapper template. More...

#include <graph-dry.H>

Inheritance diagram for Aleph::Digraph< BaseGraph >:
[legend]
Collaboration diagram for Aleph::Digraph< BaseGraph >:
[legend]

Public Types

using GT = BaseGraph
 
using Node = typename BaseGraph::Node
 
using Arc = typename BaseGraph::Arc
 

Public Member Functions

 Digraph () noexcept
 Default constructor.
 
 Digraph (const Digraph &dg)
 Copy constructor.
 
 Digraph (Digraph &&dg) noexcept
 Move constructor.
 
Digraphoperator= (const Digraph &g)
 Copy assignment operator.
 
Digraphoperator= (Digraph &&g) noexcept
 Move assignment operator.
 

Detailed Description

template<class BaseGraph>
class Aleph::Digraph< BaseGraph >

Generic directed graph (digraph) wrapper template.

This template wraps any undirected graph class and converts it into a directed graph by setting the digraph flag to true. This eliminates code duplication across the various digraph implementations (List_Digraph, List_SDigraph, Array_Digraph).

The wrapper properly handles:

  • Default construction
  • Copy construction (deep copy via copy_graph)
  • Move construction (via swap)
  • Copy assignment
  • Move assignment
Template Parameters
BaseGraphThe undirected graph class to wrap (e.g., List_Graph, List_SGraph, Array_Graph).

Example usage: cpp Instead of defining a separate List_Digraph class: template <typename Node, typename Arc> using List_Digraph = Digraph<List_Graph<Node, Arc>>;

See also
List_Graph List_SGraph Array_Graph

Definition at line 3847 of file graph-dry.H.

Member Typedef Documentation

◆ Arc

template<class BaseGraph >
using Aleph::Digraph< BaseGraph >::Arc = typename BaseGraph::Arc

Definition at line 3852 of file graph-dry.H.

◆ GT

template<class BaseGraph >
using Aleph::Digraph< BaseGraph >::GT = BaseGraph

Definition at line 3850 of file graph-dry.H.

◆ Node

template<class BaseGraph >
using Aleph::Digraph< BaseGraph >::Node = typename BaseGraph::Node

Definition at line 3851 of file graph-dry.H.

Constructor & Destructor Documentation

◆ Digraph() [1/3]

template<class BaseGraph >
Aleph::Digraph< BaseGraph >::Digraph ( )
inlinenoexcept

Default constructor.

Creates an empty directed graph.

Definition at line 3858 of file graph-dry.H.

◆ Digraph() [2/3]

template<class BaseGraph >
Aleph::Digraph< BaseGraph >::Digraph ( const Digraph< BaseGraph > &  dg)
inline

Copy constructor.

Creates a deep copy of the given digraph. All nodes and arcs are duplicated, preserving the graph topology.

Parameters
[in]dgThe digraph to copy.

Definition at line 3870 of file graph-dry.H.

References Aleph::copy_graph().

◆ Digraph() [3/3]

template<class BaseGraph >
Aleph::Digraph< BaseGraph >::Digraph ( Digraph< BaseGraph > &&  dg)
inlinenoexcept

Move constructor.

Transfers ownership of all nodes and arcs from dg to this digraph. After the move, dg will be empty.

Parameters
[in]dgThe digraph to move from.

Definition at line 3883 of file graph-dry.H.

References Aleph::swap().

Member Function Documentation

◆ operator=() [1/2]

template<class BaseGraph >
Digraph & Aleph::Digraph< BaseGraph >::operator= ( const Digraph< BaseGraph > &  g)
inline

Copy assignment operator.

Replaces the contents of this digraph with a deep copy of g. All existing nodes and arcs are removed first.

Parameters
[in]gThe digraph to copy.
Returns
Reference to this digraph.

Definition at line 3897 of file graph-dry.H.

References Aleph::copy_graph().

◆ operator=() [2/2]

template<class BaseGraph >
Digraph & Aleph::Digraph< BaseGraph >::operator= ( Digraph< BaseGraph > &&  g)
inlinenoexcept

Move assignment operator.

Transfers ownership of all nodes and arcs from g to this digraph. After the move, g will be empty.

Parameters
[in]gThe digraph to move from.
Returns
Reference to this digraph.

Definition at line 3916 of file graph-dry.H.

References Aleph::swap().


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