GraphLib
Bearbeitung der Aufgabe Mini Graph Library für OOP WiSe 2023/24
Loading...
Searching...
No Matches
abstract_graph.h File Reference

Defines the generic abstract Graph class template supporting directed/undirected and weighted/unweighted graphs. More...

#include <cstddef>
#include <iostream>
#include <limits>
#include <ostream>
#include <queue>
#include <set>
#include <stdexcept>
#include <unordered_map>
#include <vector>
#include "GraphLib/internal/adjacency_list.h"
#include "GraphLib/internal/concepts.h"

Go to the source code of this file.

Classes

class  GraphLib::Internal::Graph< D, I, E >
 Abstract base class for a generic graph structure. More...

Functions

template<valid_data_type D, valid_id_type I, valid_edge_type< I > E>
std::ostream & GraphLib::Internal::operator<< (std::ostream &os, const Graph< D, I, E > &graph)
 Stream insertion operator for any valid graph type.

Detailed Description

Defines the generic abstract Graph class template supporting directed/undirected and weighted/unweighted graphs.

This class provides a foundational graph data structure managing nodes with associated data, edges, and adjacency relationships. It includes functions for node/edge inspection, addition, removal, and basic graph queries.

Template Parameters:

  • D: Type of data stored in each node.
  • I: Type used for node IDs.
  • E: Type of edges stored in the adjacency list.

The graph maintains a mapping from node IDs to their data and an adjacency list representation for edges.

Definition in file abstract_graph.h.

Function Documentation

◆ operator<<()

template<valid_data_type D, valid_id_type I, valid_edge_type< I > E>
std::ostream & GraphLib::Internal::operator<< ( std::ostream & os,
const Graph< D, I, E > & graph )

Stream insertion operator for any valid graph type.

Enables printing of the graph object by outputting its adjacency list to the provided ostream. This is the same as calling the print_adjacency_list method on the graph.

Format: NODE_ID : [EDGE, EDGE] with EDGE being either "NODE_ID" or "NODE_ID (WEIGHT)" depending on edge type.

Template Parameters
DType of the graph data that satisfies the valid_data_type concept.
IType of the graph id that satisfies the valid_id_type concept.
EType of the graph edge that satisfies the valid_edge_type concept.
Parameters
osOutput stream to write the graph representation.
graphGraph object to be printed.
Returns
Reference to the same output stream.

Definition at line 527 of file abstract_graph.h.