84 Via(
char * nom,
int d)
87 Via(
const string& nom,
int d)
121 return p->get_info().nombre == nombre;
126 const string & c1,
const string & c2,
139 string nombre_arco = n1->get_info().nombre +
"--" + n2->get_info().nombre;
150 cout << itor.get_current_node()->get_info().nombre <<
"-";
163 cout <<
INDENT << node_itor.get_current_node()->get_info().nombre << endl;
173 Mapa::Arc * arc = arc_itor.get_current_arc();
174 cout << arc->get_info().nombre <<
" " << arc->get_info().distancia
176 <<
" a " << g.
get_tgt_node(arc)->get_info().nombre << endl;
181 <<
"Listado del grafo por nodos y en cada nodo por arcos"
186 Mapa::Node * src_node = node_itor.get_current_node();
187 cout << src_node->get_info().nombre << endl;
189 itor.has_curr(); itor.next())
191 Mapa::Arc * arc = itor.get_current_arc();
192 cout <<
INDENT << arc->get_info().distancia <<
" "
202 insert_via(g,
"San Cristobal",
"La Fria", 69);
203 insert_via(g,
"San Cristobal",
"Sacramento", 113);
204 insert_via(g,
"San Cristobal",
"San Antonio", 36);
207 insert_via(g,
"El Vigia",
"Santa Barbara", 59);
218 template <
typename GT>
248 cerr <<
"Error: buscar_ciudad(tree, \"Merida\") returned nullptr" << endl;
252 std::unique_ptr<Tree_Node<string>> t(
255 ofstream
test(
"prueba.Tree", ios::trunc);
258 cerr <<
"Error: could not open prueba.Tree for writing" << endl;
auto has_curr() const noexcept(noexcept(std::declval< I & >().has_curr())) -> decltype(std::declval< I & >().has_curr())
true if there is a current item.
Generic directed graph (digraph) wrapper template.
bool has_curr() const noexcept
Return true if the iterator has current item.
Functor class to convert a tree graph to Tree_Node structure.
Iterator on the arcs of a graph.
Graph implemented with double-linked adjacency lists.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
_Graph_Node Node
The graph type.
_Graph_Arc Arc
The node class type.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Iterator on nodes and arcs of a path.
Forward declaration used by CRTP helpers before the full node definition.
T & get_key() noexcept
Returns a modifiable reference to the node contents.
NodeInfo & get_info() noexcept
Return a modifiable reference to the data contained in the node.
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Node * get_connected_node(Arc *arc, Node *node) const noexcept
Return the adjacent node to node through arc.
constexpr size_t get_num_arcs() const noexcept
Return the number of arcs of the graph.
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
Node * search_node(Op &op) const
Linear search of a node.
Tree visualization and output generation.
Convert spanning tree graphs to Tree_Node structures.
Main namespace for Aleph-w library functions.
Arc of graph implemented with double-linked adjacency lists.
Node belonging to a graph implemented with a double linked adjacency list.
Iterator on all arcs of a graph.
bool operator()(const Ciudad &c1, const Ciudad &c2)
bool operator==(const Ciudad &c) const
Ciudad(const string &str)
void operator()(typename GT::Node *g, Tree_Node< string > *t)
static const Distance_Type Zero_Distance
Via(const string &nom, int d)
Distance_Type & get_distance()
const string operator()(Tree_Node< string > *p)
void imprimir_camino(Path< Mapa > &path)
void imprimir_mapa(Mapa &g)
List_Graph< Nodo_Ciudad, Arco_Via > Mapa
List_Digraph< Nodo_Ciudad, Arco_Via > Dimapa
Graph_Node< Ciudad > Nodo_Ciudad
Mapa::Node * buscar_ciudad(Mapa &mapa, const string &nombre)
Graph_Arc< Via > Arco_Via
void insert_via(Mapa &mapa, const string &c1, const string &c2, int distancia)
void construir_mapa(Mapa &g)
Generic graph and digraph implementations.