78#ifndef TPL_EUCLIDIAN_GRAPH_H
79#define TPL_EUCLIDIAN_GRAPH_H
90template <
typename Node_Info>
141template <
typename Arc_Info>
172template <
class __Eucl
idian_Node,
class __Eucl
idian_Arc>
178 typedef __Euclidian_Arc
Arc;
258 for (
typename Graph::Node_Iterator it(src); it.has_curr(); it.next_ne())
260 Node *p = it.get_curr();
264 for (
typename Graph::Arc_Iterator it(src); it.has_curr(); it.next_ne())
266 Arc *a = it.get_curr();
274template <
class __Eucl
idian_Node,
class __Eucl
idian_Arc>
300template <
class Node,
class Arc>
304 if (
auto *curr = it.get_curr(); curr->get_position() == point)
309template <
class __Eucl
idian_Graph>
337 if (graph.get_num_nodes() < 1)
340 typename __Euclidian_Graph::Node_Iterator itor(graph);
341 points.append(itor.get_curr()->get_position());
344 for (
int i = 1; itor.has_curr(); itor.next_ne(), ++i)
346 const Point &p = itor.get_curr()->get_position();
367 points.append(node->get_position());
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
#define ah_logic_error_if(C)
Throws std::logic_error if condition holds.
WeightedDigraph::Node Node
const Geom_Number & get_x_node_ratio() const
Point & add_point(typename __Euclidian_Graph::Node *node)
void set_y_node_ratio(const Geom_Number &_y_node_ratio)
const Geom_Number & get_y_node_ratio() const
const Point & get_west_point() const
void set_x_scale(const Geom_Number &_x_scale)
Abstract_Euclidian_Plane()
void set_x_node_ratio(const Geom_Number &_x_node_ratio)
const Geom_Number & get_y_scale() const
Geom_Number get_width() const
~Abstract_Euclidian_Plane()
const Geom_Number & get_x_scale() const
const Point & get_north_point() const
void set_y_scale(const Geom_Number &_y_scale)
Geom_Number get_height() const
const Point & get_south_point() const
const Point & get_east_point() const
Abstract_Euclidian_Plane(__Euclidian_Graph &graph)
Generic key-value map implemented on top of a binary search tree.
Pair * insert(const Key &key, const Data &data)
Insert a key-value pair.
Data & find(const Key &key)
Find the value associated with key.
Euclidian_Arc(void *src, void *tgt, const Arc_Info &info)
Euclidian_Arc(void *src, void *tgt)
Euclidian_Arc(const Arc_Info &info)
Euclidian_Digraph< __Euclidian_Node, __Euclidian_Arc > & operator=(const Euclidian_Digraph< __Euclidian_Node, __Euclidian_Arc > &eg)
Euclidian_Digraph(const Euclidian_Digraph< __Euclidian_Node, __Euclidian_Arc > &euclidian_digraph)
Euclidian_Graph(const Euclidian_Graph< Node, Arc > &euclidian_graph)
Node * insert_node(const Point &position)
void copy_from(const Euclidian_Graph< Node, Arc > &src)
Copies into this graph, which must be empty, the nodes of src, with their positions,...
Node::Node_Type Node_Type
Geom_Number get_distance(Arc *arc)
~Euclidian_Graph() override
Node * insert_node(const Node_Type &info, const Point &position)
Node * insert_node(Node *node) noexcept override
Insertion of a node already allocated.
Node * search_node(const Point &)
Euclidian_Graph< Node, Arc > & operator=(const Euclidian_Graph< Node, Arc > &eg)
Replaces the contents of this graph with a copy of eg.
List_Graph< Node, Arc > Graph
Node * insert_node(const Node_Type &info)
Euclidian_Node(const Point &_position)
const Point & get_position() const
Euclidian_Node(const Node_Info &info, const Point &_position)
Euclidian_Node(Euclidian_Node *node)
Euclidian_Node(const Node_Info &info)
Graph implemented with double-linked adjacency lists.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
void swap(List_Graph &g) noexcept
Swap in constant time this with g
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Represents a point with rectangular coordinates in a 2D plane.
const Geom_Number & get_x() const noexcept
Gets the x-coordinate value.
const Geom_Number & get_y() const noexcept
Gets the y-coordinate value.
Geom_Number distance_to(const Point &p) const
Calculates the Euclidean distance to another point.
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
void *& get_cookie() noexcept
Return a modifiable reference to graph's cookie.
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
void clear_graph(GT &g)
Clean a graph: all its nodes and arcs are removed and freed.
Main namespace for Aleph-w library functions.
Itor2 copy(Itor1 sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg)
Copy elements from one range to another.
mpq_class Geom_Number
Numeric type used by the geometry module.
2D point and geometric utilities.
Arc of graph implemented with double-linked adjacency lists.
Node belonging to a graph implemented with a double linked adjacency list.
Generic graph and digraph implementations.