GraphLib
Bearbeitung der Aufgabe Mini Graph Library für OOP WiSe 2023/24
Loading...
Searching...
No Matches
GraphLib::Internal::Edge< I > Struct Template Reference

Represents an unweighted edge to a node identified by an ID. More...

#include <edge.h>

Inheritance diagram for GraphLib::Internal::Edge< I >:
GraphLib::Internal::WeightedEdge< I, W >

Public Types

using id_type = I
 Alias for the node ID type.

Public Member Functions

bool operator< (const Edge &right) const
 Less-than operator comparing node IDs.
bool operator== (const Edge &other) const
 Equality operator comparing node IDs.
template<typename D>
requires GraphLib::Internal::is_printable<D> && GraphLib::Internal::valid_data_type<D>
void print_with_data (std::ostream &os, D value) const
 Prints an unweighted Edge with its data instead of ID.

Public Attributes

id_type node_id {}
 The ID of the node this edge points to.

Detailed Description

template<valid_id_type I>
struct GraphLib::Internal::Edge< I >

Represents an unweighted edge to a node identified by an ID.

Template Parameters
IType of the node ID; must satisfy the valid_id_type concept.

Definition at line 26 of file edge.h.

Member Typedef Documentation

◆ id_type

template<valid_id_type I>
using GraphLib::Internal::Edge< I >::id_type = I

Alias for the node ID type.

Definition at line 28 of file edge.h.

Member Function Documentation

◆ operator<()

template<valid_id_type I>
bool GraphLib::Internal::Edge< I >::operator< ( const Edge< I > & right) const
inline

Less-than operator comparing node IDs.

Enables sorting or ordering edges by their node IDs.

Parameters
rightThe other edge to compare against.
Returns
true if this edge's node_id is less than right's node_id.

Definition at line 40 of file edge.h.

◆ operator==()

template<valid_id_type I>
bool GraphLib::Internal::Edge< I >::operator== ( const Edge< I > & other) const
inline

Equality operator comparing node IDs.

Parameters
otherThe other edge to compare against.
Returns
true if both edges have the same node_id.

Definition at line 51 of file edge.h.

◆ print_with_data()

template<valid_id_type I>
void GraphLib::Internal::Edge< I >::print_with_data ( std::ostream & os,
D value ) const
inline

Prints an unweighted Edge with its data instead of ID.

Prints the node data to the output stream.

Template Parameters
Dthe Data Type
Parameters
osOutput stream.
valuethe Value behind the NodeID of this Edge.

Definition at line 67 of file edge.h.

Member Data Documentation

◆ node_id

template<valid_id_type I>
id_type GraphLib::Internal::Edge< I >::node_id {}

The ID of the node this edge points to.

Definition at line 30 of file edge.h.


The documentation for this struct was generated from the following files: