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

Generic adjacency list implementation for directed graphs. More...

#include <algorithm>
#include <cassert>
#include <iterator>
#include <ostream>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include "GraphLib/internal/concepts.h"

Go to the source code of this file.

Classes

class  GraphLib::Internal::AdjacencyList< I, E >
 Represents a directed (by nature) Adjacency List Graph Structure. More...

Functions

template<typename I, typename E>
std::ostream & GraphLib::Internal::operator<< (std::ostream &os, const AdjacencyList< I, E > &adj_list)
 Outputs the adjacency map to the given output stream.

Detailed Description

Generic adjacency list implementation for directed graphs.

This class template implements an adjacency list data structure where edges can hold arbitrary information (any subclass of Edge) and must at least contain the target node ID.

Definition in file adjacency_list.h.

Function Documentation

◆ operator<<()

template<typename I, typename E>
std::ostream & GraphLib::Internal::operator<< ( std::ostream & os,
const AdjacencyList< I, E > & adj_list )

Outputs the adjacency map to the given output stream.

Iterates over each node and its associated edges, printing the node ID followed by a list of its edges in a human-readable format. Format: NODE_ID : [EDGE, EDGE] with EDGE being either "NODE_ID" or "NODE_ID (WEIGHT)" depending on edge type

Template Parameters
Ithe Id Type used in the Adjaceny List.
Ethe Edge Type used in the Adjaceny List.
Parameters
osThe output stream to write to.
adj_listThe adjacency list to output.
Returns
Reference to the same output stream.

Definition at line 290 of file adjacency_list.h.