aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
spanningForest.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /** @file
23  * @brief Interface for computing min cost spanning trees or forests
24  *
25  * @author Jean-Philippe DUBUS & Christophe GONZALES(@AMU)
26  */
27 #ifndef GUM_SPANNING_FOREST_H
28 #define GUM_SPANNING_FOREST_H
29 #include <agrum/agrum.h>
30 
31 #include <agrum/tools/graphs/graphElements.h>
32 #include <agrum/tools/graphs/undiGraph.h>
33 
34 namespace gum {
35 
36  /* ===========================================================================
37  */
38  /** @class SpanningForest
39  * @brief Base class for computing min cost spanning trees or forests */
40  /* ===========================================================================
41  */
43  public:
44  // ############################################################################
45  /// @name Constructors / Destructors
46  // ############################################################################
47  /// @{
48 
49  /// Destructor
50  virtual ~SpanningForest();
51 
52  /// @}
53 
54  // ############################################################################
55  /// @name Accessors / Modifiers
56  // ############################################################################
57  /// @{
58 
59  /// Returns the edges in a min cost spanning forest
60  /** @returns edges in the spanning forest */
61  virtual const EdgeSet& edgesInSpanningForest() = 0;
62 
63  /// Construct the spanning forest
64  /** @return the spanning forest */
65  virtual const UndiGraph& spanningForest() = 0;
66 
67  /// Returns the cost of the spanning forest
68  /** @return cost of the spanning forest */
69  virtual float costOfSpanningForest() = 0;
70 
71  /// @}
72 
73  protected:
74  // ############################################################################
75  /// @name Constructors / Destructors
76  // ############################################################################
77  /// @{
78 
79  /// default constructor
80  /** You should use SpanningForestPrim or SpanningForestKuskal to create
81  * appropriate spanning trees algorithms. */
83 
84  /// Copy constructor
85  SpanningForest(const SpanningForest& toCopy);
86 
87  /// Copy operator
88  /** avoid copying the interface from scratch: this would prevent, in
89  * particular, that a Prim algorithm be initialized by a Kruskal algo. */
90  SpanningForest& operator=(const SpanningForest& toCopy);
91 
92  /// @}
93  };
94 
95 } /* namespace gum */
96 
97 #endif /* GUM_SPANNING_FOREST_H */
SpanningForest()
default constructor
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
SpanningForest(const SpanningForest &toCopy)
Copy constructor.
SpanningForest & operator=(const SpanningForest &toCopy)
Copy operator.
virtual ~SpanningForest()
Destructor.
virtual const EdgeSet & edgesInSpanningForest()=0
Returns the edges in a min cost spanning forest.
virtual float costOfSpanningForest()=0
Returns the cost of the spanning forest.
virtual const UndiGraph & spanningForest()=0
Construct the spanning forest.
Base class for computing min cost spanning trees or forests.