|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Calcula el árbol abarcador mínimo de un grafo según el algoritmo de Prim. More...
#include <Prim.H>
Public Member Functions | |
| Prim_Min_Spanning_Tree (Distance __dist=Distance(), SA __sa=SA()) | |
| Constructor. | |
| void | operator() (const GT &g, GT &tree) |
| Invoca al cálculo del árbol abarcador mínimo por el algoritmo de Prim. | |
| void | operator() (const GT &g, typename GT::Node *start, GT &tree) |
| Invoca al cálculo del árbol abarcador mínimo por el algoritmo de Prim. | |
| void | operator() (const GT &g) |
| overload () | |
| void | operator() (const GT &g, typename GT::Node *start) |
Private Types | |
| typedef Prim_Heap_Info< GT, Distance > | Acc_Heap |
| typedef Simple_Prim_Heap< GT, Distance > | Acc_Simple_Heap |
| typedef ArcHeap< GT, Distance, Acc_Heap > | Heap |
| typedef ArcHeap< GT, Distance, Acc_Simple_Heap > | Simple_Heap |
Private Member Functions | |
| void | paint_min_spanning_tree (const GT &g, typename GT::Node *first) |
| void | min_spanning_tree (const GT &g, typename GT::Node *first, GT &tree) |
Private Attributes | |
| Distance | dist |
| SA | sa |
Calcula el árbol abarcador mínimo de un grafo según el algoritmo de Prim.
Esta clase emplea el algoritmo de Prim para calcular el árbol abarcador mínimo de un grafo y almacenarlo en otro grafo.
El árbol abarcador mínimo tree completamente mapeado con el grafo.
El algoritmo utiliza una cola interna cuya longitud máxima es proporcional número de nodos del grafo.
El algoritmo de Prim es el recomendado para grafos densos.
El procedimiento es parametrizado con las siguientes especificaciones:
|
private |
|
private |
|
private |
|
inline |
|
inlineprivate |
Definition at line 297 of file Prim.H.
References ah_domain_error_if, ARC_BITS, Aleph::clear_graph(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::dist, GTArcCommon< ArcInfo >::get_info(), ArcHeap< GT, Distance, Access_Heap_Node >::get_min_arc(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::init, Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), IS_ARC_VISITED, GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::GenBinHeap< NodeType, Key, Compare >::is_empty(), IS_NODE_VISITED, GraphCommon< GT, Node, Arc >::map_arcs(), Aleph::maps(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_BITS, ArcHeap< GT, Distance, Access_Heap_Node >::put_arc(), GraphCommon< GT, Node, Arc >::reset_arcs(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::sa, Aleph::Spanning_Tree, and TREENODE.
Referenced by Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::operator()(), and Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::operator()().
|
inline |
overload ()
Definition at line 404 of file Prim.H.
References Aleph::List_Graph< _Graph_Node, _Graph_Arc >::get_first_node(), and Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree().
|
inline |
Invoca al cálculo del árbol abarcador mínimo por el algoritmo de Prim.
| [in] | g | el grafo al cual se desea calcular el árbol abarcador mínimo. |
| [out] | tree | el grafo donde se desea guardar el árbol abarcador mínimo resultado. Este grafo es limpiado antes del comienzo del algoritmo. |
| bad_alloc | si no hay suficiente memoria para construir tree. En este caso el valor de tree es indeterminado y no está limpio. |
Definition at line 380 of file Prim.H.
References Aleph::List_Graph< _Graph_Node, _Graph_Arc >::get_first_node(), and Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::min_spanning_tree().
|
inline |
Definition at line 409 of file Prim.H.
References Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree().
|
inline |
Invoca al cálculo del árbol abarcador mínimo por el algoritmo de Prim.
| [in] | g | el grafo al cual se desea calcular el árbol abarcador mínimo. |
| [in] | start | nodo desde el cual se inicia elalgoritmo. |
| [out] | tree | el grafo donde se desea guardar el árbol abarcador mínimo resultado. Este grafo es limpiado antes del comienzo del algoritmo. |
| bad_alloc | si no hay suficiente memoria para construir tree. En este caso el valor de tree es indeterminado y no está limpio. |
Definition at line 398 of file Prim.H.
References Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::min_spanning_tree().
|
inlineprivate |
Definition at line 239 of file Prim.H.
References ah_domain_error_if, ARC_BITS, Aleph::count(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::dist, ArcHeap< GT, Distance, Access_Heap_Node >::get_min_arc(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), IS_ARC_VISITED, GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::GenBinHeap< NodeType, Key, Compare >::is_empty(), IS_NODE_VISITED, Aleph::maps(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_BITS, ArcHeap< GT, Distance, Access_Heap_Node >::put_arc(), GraphCommon< GT, Node, Arc >::reset_arcs(), GraphCommon< GT, Node, Arc >::reset_nodes(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::sa, and Aleph::Spanning_Tree.
Referenced by Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::operator()(), and Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::operator()().
|
private |
Definition at line 223 of file Prim.H.
Referenced by Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::min_spanning_tree(), and Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree().
|
private |
Definition at line 224 of file Prim.H.
Referenced by Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::min_spanning_tree(), and Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree().