GraphDom
Loading...
Searching...
No Matches
adj_list_iterator.h
1/*
2 * Copyright 2026 Michele Comparini
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef GRAPHDOM_ADJ_LIST_ITERATOR_IMPL_H
8#define GRAPHDOM_ADJ_LIST_ITERATOR_IMPL_H
9
10#include "../../graph.h"
11#include "../adj_list_base_iterator.h"
12#include "../adj_list_iterator.h"
13
14template <typename VertexType>
15graphdom::graph<VertexType>::adj_list_iterator::adj_list_iterator(const adj_list_iterator& other_iterator) :
16graphdom::graph<VertexType>::adj_list_base_iterator< const graph<VertexType>::vertex_container* >( other_iterator ){}
17
18template<typename VertexType>
19graphdom::graph<VertexType>::adj_list_iterator::adj_list_iterator(const typename multiset_graph<VertexType>::adj_list_iterator& other_iterator) :
20graphdom::graph<VertexType>::adj_list_base_iterator< const graph<VertexType>::vertex_container* >(
21 other_iterator.iterator_owner_graph,
22 other_iterator.iterator_owner_graph_edges_type,
23 other_iterator.edge_begin_point_vertex_container,
24 other_iterator.edges_type_restriction,
25 other_iterator.inner_iterator_edge_current_type,
26 std::get< typename graph<VertexType>::adj_set<graph<VertexType>::vertex_container*>::iterator >( other_iterator.inner_iterator )
27){}
28
29/*
30template<typename VertexType>
31graphdom::graph<VertexType>::adj_list_iterator::adj_list_iterator(const typename multiset_graph<VertexType>::adj_list_iterator& other_iterator) :
32graphdom::graph<VertexType>::adj_list_base_iterator< const graph<VertexType>::vertex_container* >(
33){}
34*/
35
36template<typename VertexType>
37graphdom::graph<VertexType>::adj_list_iterator::operator typename multiset_graph<VertexType>::adj_list_iterator() const {
38 return graphdom::multiset_graph<VertexType>::adj_list_iterator(*this);
39}
40
41template<typename VertexType>
42typename graphdom::graph<VertexType>::vertex_handle graphdom::graph<VertexType>::adj_list_iterator::operator->() const {
43 return *this;
44}
45
46template<typename VertexType>
47typename graphdom::graph<VertexType>::vertex_handle graphdom::graph<VertexType>::adj_list_iterator::operator*() const {
48 return graphdom::graph<VertexType>::vertex_handle(
49 this->iterator_owner_graph,
50 this->iterator_owner_graph_edges_type,
51 ( std::holds_alternative< typename graphdom::graph<VertexType>::adj_set<graphdom::graph<VertexType>::vertex_container*>::iterator >( this->inner_iterator ) ) ?
52 ( ( *( std::get< typename graphdom::graph<VertexType>::adj_set<graphdom::graph<VertexType>::vertex_container*>::iterator >( this->inner_iterator ) ) )->vertex_container_ptr ) :
53 ( ( *( std::get< typename graphdom::graph<VertexType>::adj_set<const graphdom::graph<VertexType>::vertex_container*>::iterator >( this->inner_iterator ) ) )->vertex_container_ptr )
54 );
55}
56
57template<typename VertexType>
58typename graphdom::graph<VertexType>::adj_list_iterator& graphdom::graph<VertexType>::adj_list_iterator::operator=(const adj_list_iterator& other) {
59 if ( this != &other ) {
60 this->iterator_owner_graph = other.iterator_owner_graph;
61 this->iterator_owner_graph_edges_type = other.iterator_owner_graph_edges_type;
62 this->edge_begin_point_vertex_container = other.edge_begin_point_vertex_container;
63 this->edges_type_restriction = other.edges_type_restriction;
64 this->inner_iterator_edge_current_type;
65 this->inner_iterator = other.inner_iterator;
66 }
67 return (*this);
68}
69
70template<typename VertexType>
71typename graphdom::graph<VertexType>::adj_list_iterator& graphdom::graph<VertexType>::adj_list_iterator::operator++() {
72 this->internal_single_increment();
73 return *this;
74}
75
76template<typename VertexType>
77typename graphdom::graph<VertexType>::adj_list_iterator graphdom::graph<VertexType>::adj_list_iterator::operator++(int) {
78 auto to_return = *this;
79 ++(*this);
80 return to_return;
81}
82
83template<typename VertexType>
84graphdom::graph<VertexType>::adj_list_iterator::adj_list_iterator(const typename graph<VertexType>::adj_list_base_iterator<const typename graph<VertexType>::vertex_container*>& other) :
85graphdom::graph<VertexType>::adj_list_base_iterator< const graph<VertexType>::vertex_container* >( other ){}
86
87template<typename VertexType>
88graphdom::graph<VertexType>::adj_list_iterator::adj_list_iterator(
89 const graph<VertexType>* const iterator_owner_pointer,
90 const typename graph<VertexType>::graph_edges_type iterator_owner_graph_edges_type,
91 const typename graph<VertexType>::vertex_container* const edge_begin_point_vertex_container,
92 const typename graph<VertexType>::edges_type_selection_type edges_type_restriction,
93 const graphdom::edge_type inner_iterator_edge_current_type) :
94graphdom::graph<VertexType>::adj_list_base_iterator< const graph<VertexType>::vertex_container* >(
95 iterator_owner_pointer,
96 iterator_owner_graph_edges_type,
97 edge_begin_point_vertex_container,
98 edges_type_restriction,
99 inner_iterator_edge_current_type
100){}
101
102template<typename VertexType>
103graphdom::graph<VertexType>::adj_list_iterator::adj_list_iterator(
104 const graph<VertexType>* const iterator_owner_pointer,
105 const typename graph<VertexType>::graph_edges_type iterator_owner_graph_edges_type,
106 const typename graph<VertexType>::vertex_container* const edge_begin_point_vertex_container,
107 const typename graph<VertexType>::edges_type_selection_type edges_type_restriction,
108 const graphdom::edge_type inner_iterator_edge_current_type,
109 const typename graph<VertexType>::adj_set<typename graph<VertexType>::vertex_container*>::iterator& inner_iterator) :
110graphdom::graph<VertexType>::adj_list_base_iterator< const graph<VertexType>::vertex_container* >(
111 iterator_owner_pointer,
112 iterator_owner_graph_edges_type,
113 edge_begin_point_vertex_container,
114 edges_type_restriction,
115 inner_iterator_edge_current_type,
116 inner_iterator
117){}
118
119template<typename VertexType>
120graphdom::graph<VertexType>::adj_list_iterator::adj_list_iterator(
121 const graph<VertexType>* const iterator_owner_pointer,
122 const typename graph<VertexType>::graph_edges_type iterator_owner_graph_edges_type,
123 const typename graph<VertexType>::vertex_container* const edge_begin_point_vertex_container,
124 const typename graph<VertexType>::edges_type_selection_type edges_type_restriction,
125 const graphdom::edge_type inner_iterator_edge_current_type,
126 const typename graph<VertexType>::adj_set<const typename graph<VertexType>::vertex_container*>::iterator& inner_iterator) :
127graphdom::graph<VertexType>::adj_list_base_iterator< const graph<VertexType>::vertex_container* >(
128 iterator_owner_pointer,
129 iterator_owner_graph_edges_type,
130 edge_begin_point_vertex_container,
131 edges_type_restriction,
132 inner_iterator_edge_current_type,
133 inner_iterator
134){}
135
136#endif //GRAPHDOM_ADJ_LIST_ITERATOR_IMPL_H
Every valid instance of this class can be used to identify a specific vertex of a graph and to access...
Definition vertex_handle.h:32
Every graph created using this library is an instance of a concrete class publicly derived,...
Definition graph.h:43
Definition adj_list.h:16
edge_type
The enumerated type whose values represent the two types of edges of a graph.
Definition graph.h:21