aGrUM  0.14.2
spanningForestPrim.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
26 #ifndef GUM_SPANNING_FOREST_PRIM_H
27 #define GUM_SPANNING_FOREST_PRIM_H
28 
31 
32 namespace gum {
33 
34  /* ===========================================================================
35  */
40  /* ===========================================================================
41  */
43  public:
44  // ############################################################################
46  // ############################################################################
48 
50 
60  SpanningForestPrim(const UndiGraph* graph,
61  const EdgeProperty< float >* costTable);
62 
65 
67  virtual ~SpanningForestPrim();
68 
70 
71  // ############################################################################
73  // ############################################################################
75 
77 
79 
81 
82  const UndiGraph& spanningForest();
83 
85 
86  float costOfSpanningForest();
87 
89 
90  private:
93 
96 
99 
102 
105 
108 
110  void __compute();
111 
113  void __computeInAComponent(const NodeId id);
114 
116  void __exploreNode(const NodeId id);
117 
120  };
121 
122 } /* namespace gum */
123 
124 #endif /* GUM_SPANNING_FOREST_PRIM_H */
const EdgeProperty< float > & __costTable
the costs of the edges
const UndiGraph & __graph
the graph the spanning tree of which we wish to compute
UndiGraph __spanning_tree
the computed spanning tree
SpanningForestPrim(const UndiGraph *graph, const EdgeProperty< float > *costTable)
Default constructor.
const UndiGraph & spanningForest()
Construct the spanning forest.
The Prim algorithm for computing min cost spanning trees or forests.
void __computeInAComponent(const NodeId id)
compute a spanning tree in a given connected component of __graph
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
const EdgeSet & edgesInSpanningForest()
Returns the edges in a min cost spanning forest.
The class for generic Hash Tables.
Definition: hashTable.h:676
float costOfSpanningForest()
Returns the cost of the spanning forest.
A priorityQueue is a heap in which each element has a mutable priorityA priority queue is quite simil...
Definition: priorityQueue.h:48
Interface for computing min cost spanning trees or forests.
virtual ~SpanningForestPrim()
Destructor.
SpanningForestPrim & operator=(const SpanningForestPrim &toCopy)
Copy operator: private to prevent using it.
priority queues (in which an element cannot appear more than once)
void __exploreNode(const NodeId id)
explore the neighborhood of a node belonging to the spanning tree
Base class for undirected graphs.
Definition: undiGraph.h:106
float __spanning_tree_cost
the cost of the spanning tree
void __compute()
Computes the spanning forest.
PriorityQueue< Edge, float > __edgesToExplore
the next edges that may be added to the spanning tree
Base class for computing min cost spanning trees or forests.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
bool __require_computation
a Boolean indicating whether we need recompute the spanning tree