108 return c1.nombre ==
c2.nombre;
117 return p->get_info().nombre == nombre;
122 const string &
c1,
const string &
c2,
128 n1 =
mapa.insert_node(
c1);
133 n2 =
mapa.insert_node(
c2);
135 string nombre_arco = n1->get_info().nombre +
"--" + n2->get_info().nombre;
146 cout <<
itor.get_current_node()->get_info().nombre <<
"-";
170 cout << arc->get_info().nombre <<
" " << arc->get_info().distancia
177 <<
"Graph listing by nodes and for each node by arcs"
183 cout << src_node->get_info().nombre <<
endl;
188 cout <<
INDENT << arc->get_info().distancia <<
" "
198 insert_via(g,
"San Cristobal",
"La Fria", 69);
199 insert_via(g,
"San Cristobal",
"Sacramento", 113);
200 insert_via(g,
"San Cristobal",
"San Antonio", 36);
203 insert_via(g,
"El Vigia",
"Santa Barbara", 59);
214 template <
typename GT>
234 for (
size_t i = 0; i < n; ++i)
253 <<
"buscar_ciudad(tree, \"Merida\") returned nullptr";
255 std::unique_ptr<Tree_Node<string>> t(
260 cout <<
"Enter key to search (type \"quit\"): ";
262 if (
not std::getline(std::cin,
clave))
272 const size_t Buf_Size = 512;
281 cout <<
clave <<
" was not found in the tree" <<
endl;
284 cout <<
clave <<
" has Deway number: ";
290 cout <<
"Exiting ... " <<
endl;
292 ofstream
test(
"prueba.Tree", ios::trunc);
294 <<
"could not open prueba.Tree for writing";
Exception handling system with formatted messages for Aleph-w.
#define ah_runtime_error_if(C)
Throws std::runtime_error if condition holds.
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.
_Graph_Node Node
The graph type.
_Graph_Arc Arc
The node class type.
Iterator on nodes and arcs of a path.
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.
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
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
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
void deway(Tree_Node< int > *p, int prefix[], const int &len, const size_t &dim)
Recursively compute and print Deway numbering for a tree node.
Tree visualization and output generation.
Convert spanning tree graphs to Tree_Node structures.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
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)
void escribir_deway(int deway[], const size_t &n)
Generic graph and digraph implementations.