107 return c1.nombre ==
c2.nombre;
116 return p->get_info().nombre == nombre;
121 const string &
c1,
const string &
c2,
127 n1 =
mapa.insert_node(
c1);
132 n2 =
mapa.insert_node(
c2);
134 string nombre_arco = n1->get_info().nombre +
"--" + n2->get_info().nombre;
145 cout <<
itor.get_current_node()->get_info().nombre <<
"-";
169 cout << arc->get_info().nombre <<
" " << arc->get_info().distancia
176 <<
"Listado del grafo por nodos y en cada nodo por arcos"
182 cout << src_node->get_info().nombre <<
endl;
187 cout <<
INDENT << arc->get_info().distancia <<
" "
197 insert_via(g,
"San Cristobal",
"La Fria", 69);
198 insert_via(g,
"San Cristobal",
"Sacramento", 113);
199 insert_via(g,
"San Cristobal",
"San Antonio", 36);
202 insert_via(g,
"El Vigia",
"Santa Barbara", 59);
213 template <
typename GT>
243 cerr <<
"Error: buscar_ciudad(tree, \"Merida\") returned nullptr" <<
endl;
247 std::unique_ptr<Tree_Node<string>> t(
250 ofstream
test(
"prueba.Tree", ios::trunc);
253 cerr <<
"Error: could not open prueba.Tree for writing" <<
endl;
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)
Tree visualization and output generation.
Convert spanning tree graphs to Tree_Node structures.
Main namespace for Aleph-w library functions.
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)
Generic graph and digraph implementations.