Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
tpl_agraph.H
Go to the documentation of this file.
2/*
3 Aleph_w
4
5 Data structures & Algorithms
6 version 2.0.0b
7 https://github.com/lrleon/Aleph-w
8
9 This file is part of Aleph-w library
10
11 Copyright (c) 2002-2026 Leandro Rabindranath Leon
12
13 Permission is hereby granted, free of charge, to any person obtaining a copy
14 of this software and associated documentation files (the "Software"), to deal
15 in the Software without restriction, including without limitation the rights
16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 copies of the Software, and to permit persons to whom the Software is
18 furnished to do so, subject to the following conditions:
19
20 The above copyright notice and this permission notice shall be included in all
21 copies or substantial portions of the Software.
22
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 SOFTWARE.
30*/
31
32
44# ifndef TPL_AGRAPH_H
45# define TPL_AGRAPH_H
46
47# include <tpl_dynSetTree.H>
48# include <array_it.H>
49# include <tpl_sgraph.H>
50# include <ah-errors.H>
51
52namespace Aleph
53{
54 using namespace Aleph;
55
60 template <typename Node_Info = Empty_Class>
62 : public Dlink,
63 public GTNodeCommon<Node_Info>
64 {
66 friend class GTNodeCommon<Node_Info>;
67
68 static constexpr size_t Contract_Factor = 4;
69 static constexpr size_t Default_Cap = 4;
70
71 void init(const size_t dim)
72 {
73 arcs_dim = dim;
74 this->num_arcs = 0;
76 arc_array = nullptr;
77 if (arcs_dim == 0)
78 return;
79
80 arc_array = static_cast<void **>(malloc(arcs_dim * sizeof(void *)));
81 ah_bad_alloc_if(arc_array == nullptr);
82 }
83
84 public:
85 void **arc_array = nullptr;
86 size_t arcs_dim = 0;
88
90 {
91 init(0);
92 }
93
94 Graph_Anode(const Node_Info & info) : Base(info)
95 {
97 }
98
99 Graph_Anode(Node_Info && info) : Base(std::move(info))
100 {
102 }
103
104 Graph_Anode(const Graph_Anode & node) : Dlink(), Base(node.node_info)
105 {
106 init(0);
107 }
108
110 {
111 if (&node == this)
112 return *this;
113 this->node_info = node.node_info;
114 return *this;
115 }
116
118 {
119 init(0);
120 }
121
122 virtual ~Graph_Anode()
123 {
124 if (arc_array != nullptr)
125 free(arc_array);
126 }
127
128 private:
129 // Gives the array room for new_size arcs, or frees it if new_size is 0:
130 // realloc() with a size of 0 may free the array and give back nullptr,
131 // which would look like a failure. If realloc() fails, the array is as
132 // it was, and the result is false.
133 bool resize_arc_array(const size_t new_size) noexcept
134 {
135 if (new_size == 0)
136 {
137 free(arc_array);
138 arc_array = nullptr;
139 arcs_dim = 0;
141 return true;
142 }
143
144 const auto new_array = static_cast<void **>(realloc(arc_array, new_size * sizeof(void *)));
145 if (new_array == nullptr)
146 return false;
147
148 arc_array = new_array;
149 arcs_dim = new_size;
151 return true;
152 }
153
154 // After a removal, halves the array if it has room for four times the
155 // arcs; if realloc() fails, the array keeps its room
156 void contract_arc_array() noexcept
157 {
158 if (this->num_arcs > contract_threshold)
159 return;
160
161 (void) resize_arc_array(arcs_dim >> 1); // num_arcs/2
162 }
163
164 public:
165 void allocate_more(size_t new_size)
166 {
167 if (new_size == 0)
168 new_size = 1;
169
170 ah_bad_alloc_if(not resize_arc_array(new_size));
171 }
172
173 void * insert_arc(void * arc)
174 {
175 // Defensive: adjacency storage must be consistent before insertion.
176 // If any invariant is broken, reset and reallocate using malloc.
177 // NOTE: Do NOT free arc_array here - if we hit this condition, arc_array
178 // likely contains garbage from uninitialized memory (not a valid allocation).
179 if (arc_array == nullptr or arcs_dim == 0 or this->num_arcs > arcs_dim)
180 {
181 arc_array = static_cast<void **>(malloc(Default_Cap * sizeof(void *)));
182 ah_bad_alloc_if(arc_array == nullptr);
185 this->num_arcs = 0;
186 }
187
188 if (this->num_arcs == arcs_dim)
189 allocate_more(arcs_dim << 1); // 2*arcs_dim
190
191 arc_array[this->num_arcs++] = arc;
192
193 return arc;
194 }
195
196 void remove_arc_ne(const void *arc) noexcept
197 {
198 for (size_t i = 0; i < this->num_arcs; ++i)
199 if (arc_array[i] == arc)
200 {
201 arc_array[i] = arc_array[--(this->num_arcs)];
202 break;
203 }
204
206 }
207
208 void remove_arc(const void *arc)
209 {
210 bool removed = false;
211 for (size_t i = 0; i < this->num_arcs; ++i)
212 if (arc_array[i] == arc)
213 {
214 arc_array[i] = arc_array[--(this->num_arcs)];
215 removed = true;
216 break;
217 }
218
219 ah_domain_error_if(not removed) << "arc for deleting not found";
220
222 }
223
224 bool compress() noexcept
225 {
226 return resize_arc_array(this->num_arcs);
227 }
228 };
229
230
231 template <typename Arc_Info = Empty_Class>
233 : public Dlink,
234 public GTArcCommon<Arc_Info>
235 {
236 friend class GTArcCommon<Arc_Info>;
238
239 public:
240 Graph_Aarc(const Arc_Info & info)
241 : Base(info)
242 {
243 /* empty */
244 }
245
247 : Base(std::move(info))
248 {
249 /* empty */
250 }
251
253 : Graph_Aarc(arc.arc_info)
254 { /* empty */
255 }
256
258 {
259 if (&arc == this)
260 return *this;
261 this->arc_info = arc.arc_info;
262 return *this;
263 }
264
265 Graph_Aarc(void *src, void *tgt, const Arc_Info & data)
266 : Base(src, tgt, data)
267 {
268 // empty
269 }
270
271 Graph_Aarc(void *src, void *tgt, Arc_Info && data = Arc_Info())
272 : Base(src, tgt, std::move(data))
273 {
274 // empty
275 }
276 };
277
278
279 template <class __Graph_Node = Graph_Anode<unsigned long>,
280 class __Graph_Arc = Graph_Aarc<unsigned long>>
282 : public GraphCommon<Array_Graph<__Graph_Node, __Graph_Arc>,
283 __Graph_Node, __Graph_Arc>
284 {
285 public:
286 using Node = __Graph_Node;
287 using Arc = __Graph_Arc;
288 using Node_Type = typename Node::Node_Type;
289 using Arc_Type = typename Arc::Arc_Type;
290
291 friend class GraphCommon<Array_Graph<__Graph_Node, __Graph_Arc>,
292 __Graph_Node, __Graph_Arc>;
293
295 __Graph_Node, __Graph_Arc>;
296
299
300 private:
301 // using DynSetNode = DynSetTree<Node*, Avl_Tree>;
303
306
307 public:
309 Dlink & get_node_dlink() noexcept { return node_set; }
310
312 Dlink & get_arc_dlink() noexcept { return arc_set; }
313
314 struct Node_Iterator : public GTNodeIterator<Array_Graph>
315 {
317 using Base::Base;
318
319 Node_Iterator(const Array_Graph & g) noexcept
320 : Base(const_cast<Dlink &>(g.node_set))
321 {
322 // empty
323 }
324 };
325
333 struct Arc_Iterator : public GTArcIterator<Array_Graph>
334 {
336 using Base::Base;
337
339 : Base(const_cast<Dlink &>(g.arc_set))
340 {
341 // empty
342 }
343 };
344
354 {
355 void **arcs = nullptr;
356 long num_arcs = 0;
357 long pos = 0; // the position of the current arc
358 Node *src_node = nullptr;
359
360 public:
362 using Item_Type = Arc *;
363
365 using Set_Type = Node *;
366
369 { /* empty */
370 }
371
373 Node_Arc_Iterator(Node *src) noexcept
374 : arcs(src->arc_array), num_arcs(static_cast<long>(src->num_arcs)),
375 src_node(src)
376 {
377 // empty
378 }
379
381 void ** get_base() noexcept { return arcs; }
382
384 void * const * get_base() const noexcept { return arcs; }
385
387 bool has_curr() const noexcept { return pos >= 0 and pos < num_arcs; }
388
390 bool is_last() const noexcept
391 {
392 return has_curr() and pos == num_arcs - 1;
393 }
394
396 long get_pos() const noexcept { return pos; }
397
403 Arc * get_curr() const
404 {
406 << "Array_Iterator::get_curr(): no current item";
408 << "Array_Iterator::get_curr(): no current item";
409 return get_curr_ne();
410 }
411
413 Arc * get_curr_ne() const noexcept
414 {
415 return static_cast<Arc *>(arcs[pos]);
416 }
419 void next_ne() noexcept { ++pos; }
420
426 void next()
427 {
429 << "Array_Iterator::next(): no current item";
430 next_ne();
431 }
432
434 void prev_ne() noexcept { --pos; }
435
441 void prev()
442 {
444 << "Array_Iterator::prev(): no current item";
445 prev_ne();
446 }
447
449 void reset() noexcept { pos = 0; }
450
452 void reset_first() noexcept { reset(); }
453
455 void reset_last() noexcept { pos = num_arcs - 1; }
456
459 void set_pos(const long new_pos) noexcept { pos = new_pos; }
460
462 void end() noexcept { pos = num_arcs; }
463
465 Arc * get_current_arc_ne() const noexcept { return get_curr_ne(); }
466
468 Arc * get_current_arc() const { return get_curr(); }
469
472 {
473 Arc *a = get_curr_ne();
474 return static_cast<Node *>(a->get_connected_node(src_node));
475 }
476
479 {
480 Arc *a = get_curr();
481 return static_cast<Node *>(a->get_connected_node(src_node));
482 }
483 };
484
494 virtual Node * insert_node(Node *p)
495 {
496 assert(p != nullptr);
497 assert(p->num_arcs == 0);
498
499 try
500 {
501 node_set.append(p);
502 }
503 catch (...)
504 {
505 delete p;
506 throw;
507 }
508 ++this->num_nodes;
509
510 return p;
511 }
512
513 void compress()
514 {
515 for (Node_Iterator it(*this); it.has_curr(); it.next_ne())
516 it.get_curr()->compress();
517 }
518
519 private:
520 Arc * try_insert_arc(Node *src, Node *tgt, void *a)
521 {
522 Arc *aptr = static_cast<Arc *>(a);
523
524 aptr->src_node = src;
525 aptr->tgt_node = tgt;
526 src->insert_arc(aptr);
527
528 if (not this->digraph and src != tgt)
529 {
530 try
531 {
532 tgt->insert_arc(aptr);
533 }
534 catch (const std::bad_alloc &)
535 {
536 src->remove_arc(aptr);
537 throw;
538 }
539 }
540
541 try
542 {
543 arc_set.append(aptr);
544 ++this->num_arcs;
545 }
546 catch (const std::bad_alloc &)
547 {
548 src->remove_arc(aptr);
549 if (not this->digraph and src != tgt)
550 tgt->remove_arc(aptr);
551 throw;
552 }
553
554 return aptr;
555 }
556
557 public:
559 {
560 return
561 try_insert_arc(this->get_src_node(arc), this->get_tgt_node(arc), arc);
562 }
563
564 private:
565 Arc * insert_arc(Node *src, Node *tgt, void *a)
566 {
567 bool compress_done = false;
568
569 retry:
570 try
571 {
572 return try_insert_arc(src, tgt, a);
573 }
574 catch (const std::bad_alloc &)
575 {
576 if (compress_done)
577 throw;
578
579 compress();
580 compress_done = true;
581 goto retry;
582 }
583 }
584
585 public:
587 {
588 Node *src = static_cast<Node *>(arc->src_node);
589 Node *tgt = static_cast<Node *>(arc->tgt_node);
590
591 src->remove_arc_ne(arc);
592 if (not this->digraph and src != tgt)
593 tgt->remove_arc_ne(arc);
594
595 arc->del(); // delete it from arc_set
596 --this->num_arcs;
597
598 return arc;
599 }
600
601 virtual void remove_arc(Arc *a)
602 {
603 delete disconnect_arc(a);
604 }
605
606 virtual void remove_node(Node *p)
607 {
608 if (this->digraph)
609 // traverse all arcs of graph and remove those whose source or target is p
610 this->remove_arcs_if([p, this](auto arc) {
611 return this->get_src_node(arc) == p or this->get_tgt_node(arc) == p;
612 });
613 else
614 {
615 // traverse arcs of node (collect then delete for safe iteration)
617 for (size_t i = 0, n = p->num_arcs; i < n; ++i)
618 arcs.append(static_cast<Arc *>(p->arc_array[i]));
619 arcs.for_each([this](auto arc) { this->remove_arc(arc); });
620 }
621
622 p->del(); // remove from node_set
623 --this->num_nodes;
624
625 delete p;
626 }
627
630 {
631 ah_range_error_if(this->num_nodes == 0) << "Graph has not nodes";
632 return static_cast<Node *>(node_set.get_first());
633 }
634
637 {
638 ah_range_error_if(this->num_arcs == 0) << "Graph has not arcs";
639 return static_cast<Arc *>(arc_set.get_first());
640 }
641
643 {
644 ah_range_error_if(this->get_num_arcs(p) == 0) << "Node has no arcs";
645 return static_cast<Arc *>(p->arc_array[0]);
646 }
647
649 {
650 assert(this->num_nodes == 0 and this->num_arcs == 0 and
652 }
653
654 private:
655 void clear() noexcept
656 {
657 while (not arc_set.is_empty())
658 delete static_cast<Arc *>(arc_set.remove_first());
659
660 while (not node_set.is_empty())
661 delete static_cast<Node *>(node_set.remove_first());
662
663 this->num_nodes = this->num_arcs = 0;
664 }
665
666 public:
667 virtual ~Array_Graph() noexcept
668 {
669 clear();
670 }
671
672 void swap(Array_Graph & g) noexcept
673 {
674 this->common_swap(g);
675 node_set.swap(g.node_set);
676 arc_set.swap(g.arc_set);
677 }
678
681
682 // sort_nodes() and sort_arcs() are inherited from GraphCommon via CRTP
683 // They use the get_node_dlink() and get_arc_dlink() accessors defined above
684 };
685
706 template <typename __Graph_Node = Graph_Anode<int>,
707 typename __Graph_Arc = Graph_Aarc<int>>
709
710} // namespace Aleph {
711
712# endif // TPL_AGRAPH_H
Exception handling system with formatted messages for Aleph-w.
#define ah_underflow_error_if(C)
Throws std::underflow_error if condition holds.
Definition ah-errors.H:517
#define ah_overflow_error_if(C)
Throws std::overflow_error if condition holds.
Definition ah-errors.H:611
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
Definition ah-errors.H:670
#define ah_bad_alloc_if(C)
Throws std::bad_alloc if condition holds.
Definition ah-errors.H:578
#define ah_range_error_if(C)
Throws std::range_error if condition holds.
Definition ah-errors.H:356
Iterator wrapper for C++ raw arrays and circular buffers.
string Node_Info
Iterator over the arcs of a node.
Definition tpl_agraph.H:354
void prev_ne() noexcept
Move to the previous arc; the iterator must be on an arc.
Definition tpl_agraph.H:434
void reset_last() noexcept
Put the iterator on the last arc.
Definition tpl_agraph.H:455
void next()
Move to the next arc.
Definition tpl_agraph.H:426
Node_Arc_Iterator(Node *src) noexcept
Instantiate an iterator over node src.
Definition tpl_agraph.H:373
Node * get_tgt_node_ne() const
Return the target node of the current arc.
Definition tpl_agraph.H:471
Node * get_tgt_node() const
Return the target node of the current arc; it throws as get_curr().
Definition tpl_agraph.H:478
void *const * get_base() const noexcept
Return the array of the arcs of the node.
Definition tpl_agraph.H:384
void prev()
Move to the previous arc.
Definition tpl_agraph.H:441
bool is_last() const noexcept
Return true if the iterator is on the last arc.
Definition tpl_agraph.H:390
void reset_first() noexcept
Put the iterator on the first arc.
Definition tpl_agraph.H:452
Node_Arc_Iterator() noexcept
Instantiate an empty (invalid) iterator.
Definition tpl_agraph.H:368
void end() noexcept
Put the iterator past the last arc.
Definition tpl_agraph.H:462
Node * Set_Type
The set type over which iteration is performed.
Definition tpl_agraph.H:365
bool has_curr() const noexcept
Return true if the iterator is on an arc.
Definition tpl_agraph.H:387
Arc * get_current_arc_ne() const noexcept
Return the current arc.
Definition tpl_agraph.H:465
void next_ne() noexcept
Move to the next arc; the iterator must be on an arc.
Definition tpl_agraph.H:419
Arc * get_curr_ne() const noexcept
Return the current arc, which must exist.
Definition tpl_agraph.H:413
Arc * get_current_arc() const
Return the current arc.
Definition tpl_agraph.H:468
void ** get_base() noexcept
Return the array of the arcs of the node.
Definition tpl_agraph.H:381
Arc * get_curr() const
Return the current arc.
Definition tpl_agraph.H:403
long get_pos() const noexcept
Return the position of the current arc, counted from 0.
Definition tpl_agraph.H:396
void set_pos(const long new_pos) noexcept
Put the iterator on position new_pos; the number of arcs is the position past the last one.
Definition tpl_agraph.H:459
void reset() noexcept
Put the iterator on the first arc.
Definition tpl_agraph.H:449
typename Arc::Arc_Type Arc_Type
Definition tpl_agraph.H:289
virtual void remove_arc(Arc *a)
Definition tpl_agraph.H:601
virtual Node * insert_node(Node *p)
Inserts the node p, made with new, which the graph takes.
Definition tpl_agraph.H:494
void swap(Array_Graph &g) noexcept
Definition tpl_agraph.H:672
Arc * get_first_arc(Node *p) const
Definition tpl_agraph.H:642
Arc * disconnect_arc(Arc *arc)
Definition tpl_agraph.H:586
Dlink & get_arc_dlink() noexcept
Returns reference to internal arc Dlink for sorting operations.
Definition tpl_agraph.H:312
Arc * try_insert_arc(Node *src, Node *tgt, void *a)
Definition tpl_agraph.H:520
virtual ~Array_Graph() noexcept
Definition tpl_agraph.H:667
virtual void remove_node(Node *p)
Definition tpl_agraph.H:606
Arc * get_first_arc() const
Definition tpl_agraph.H:636
Node * get_first_node() const
Definition tpl_agraph.H:629
__Graph_Node Node
Definition tpl_agraph.H:286
Arc * insert_arc(Node *src, Node *tgt, void *a)
Definition tpl_agraph.H:565
void clear() noexcept
Definition tpl_agraph.H:655
Arc * connect_arc(Arc *arc)
Definition tpl_agraph.H:558
typename Node::Node_Type Node_Type
Definition tpl_agraph.H:288
Dlink & get_node_dlink() noexcept
Returns reference to internal node Dlink for sorting operations.
Definition tpl_agraph.H:309
Generic directed graph (digraph) wrapper template.
Definition graph-dry.H:4377
Doubly-linked list (defined in tpl_dynList.H).
Definition htlist.H:1231
T & append(const T &item)
Definition htlist.H:1362
Graph_Aarc(Arc_Info &&info=Arc_Info())
Definition tpl_agraph.H:246
Graph_Aarc(const Arc_Info &info)
Definition tpl_agraph.H:240
Graph_Aarc(void *src, void *tgt, const Arc_Info &data)
Definition tpl_agraph.H:265
Graph_Aarc(const Graph_Aarc &arc)
Definition tpl_agraph.H:252
Graph_Aarc(void *src, void *tgt, Arc_Info &&data=Arc_Info())
Definition tpl_agraph.H:271
Graph_Aarc & operator=(const Graph_Aarc &arc)
Definition tpl_agraph.H:257
Node of Array_Graph
Definition tpl_agraph.H:64
Graph_Anode & operator=(const Graph_Anode &node)
Definition tpl_agraph.H:109
void remove_arc(const void *arc)
Definition tpl_agraph.H:208
static constexpr size_t Default_Cap
Definition tpl_agraph.H:69
void * insert_arc(void *arc)
Definition tpl_agraph.H:173
void remove_arc_ne(const void *arc) noexcept
Definition tpl_agraph.H:196
Graph_Anode(Node_Info &&info)
Definition tpl_agraph.H:99
size_t contract_threshold
Definition tpl_agraph.H:87
void allocate_more(size_t new_size)
Definition tpl_agraph.H:165
static constexpr size_t Contract_Factor
Definition tpl_agraph.H:68
Graph_Anode(const Node_Info &info)
Definition tpl_agraph.H:94
bool compress() noexcept
Definition tpl_agraph.H:224
virtual ~Graph_Anode()
Definition tpl_agraph.H:122
Graph_Anode(const Graph_Anode &node)
Definition tpl_agraph.H:104
void contract_arc_array() noexcept
Definition tpl_agraph.H:156
Graph_Anode(Graph_Anode *p)
Definition tpl_agraph.H:117
void init(const size_t dim)
Definition tpl_agraph.H:71
bool resize_arc_array(const size_t new_size) noexcept
Definition tpl_agraph.H:133
Common methods for the arc of a graph.
Definition graph-dry.H:787
void * tgt_node
Please don't use.
Definition graph-dry.H:793
void * get_connected_node(void *node) noexcept
Definition graph-dry.H:859
ArcInfo arc_info
Definition graph-dry.H:801
ArcInfo Arc_Type
Definition graph-dry.H:790
void * src_node
Definition graph-dry.H:792
Common attributes and methods for nodes (vertexes) belonging to graphs.
Definition graph-dry.H:694
NodeInfo node_info
Definition graph-dry.H:702
NodeInfo & get_info() noexcept
Return a modifiable reference to the data contained in the node.
Definition graph-dry.H:753
size_t num_arcs
data associated to the node. Access it with get_info()
Definition graph-dry.H:713
Common methods to the Aleph-w ( ) graph classes.
Definition graph-dry.H:877
Container< Arc * > arcs() const
Return a container with all the arcs of the graph.
Definition graph-dry.H:3080
size_t num_nodes
Definition graph-dry.H:901
Node * insert_node(const Node_Type &node_info)
Allocate a new node, set by copy its data content and insert it into the graph.
Definition graph-dry.H:1402
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Definition graph-dry.H:1017
size_t num_arcs
Definition graph-dry.H:902
void common_swap(GT &g) noexcept
Definition graph-dry.H:921
Arc * insert_arc(Node *src, Node *tgt, const Arc_Type &arc_info)
Create and insert a new arc linking two nodes and copying data.
Definition graph-dry.H:1479
constexpr size_t get_num_arcs() const noexcept
Return the number of arcs of the graph.
Definition graph-dry.H:1064
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
Definition graph-dry.H:1023
void remove_arcs_if(Predicate pred)
Remove all arcs matching a predicate.
Definition graph-dry.H:4177
__gmp_expr< typename __gmp_resolve_expr< T, V >::value_type, __gmp_binary_expr< __gmp_expr< T, U >, __gmp_expr< V, W >, __gmp_dim_function > > dim(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
Definition gmpfrxx.h:4130
#define ALEPH_GRAPH_COPY_MOVE_CTORS(GraphClass)
Macro to generate copy/move constructors and assignment operators.
Definition graph-dry.H:4311
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
STL namespace.
Iterator over arcs of a graph.
Definition tpl_agraph.H:334
Arc_Iterator(const Array_Graph &g)
Definition tpl_agraph.H:338
Node_Iterator(const Array_Graph &g) noexcept
Definition tpl_agraph.H:319
GTNodeIterator< Array_Graph > Base
Definition tpl_agraph.H:316
Common arc iterator for graph having its arcs derived from Dlink class.
Definition graph-dry.H:542
Common node iterator for graph having its node derived from Dlink class.
Definition graph-dry.H:497
Dynamic set implementations based on balanced binary search trees.
Simple graph implementation with adjacency lists.