118 for (
const auto node:
_graph_.nodes()) {
168 for (
const auto node:
_graph_.neighbours(
id)) {
173 "no cost defined for edge (" << edge.
first() <<
"," << edge.
second() <<
")")
The base class for all undirected edges.
GUM_NODISCARD NodeId first() const
returns one extremal node ID (whichever one it is is unspecified)
GUM_NODISCARD NodeId second() const
returns the node ID of the other extremal node ID
Exception base for graph error.
Exception : the element we looked for cannot be found.
UndiGraph _spanning_tree_
the computed spanning tree
SpanningForestPrim(const UndiGraph *graph, const EdgeProperty< float > *costTable)
Default constructor.
float costOfSpanningForest() override
Returns the cost of the spanning forest.
const UndiGraph & spanningForest() override
Construct the spanning forest.
const EdgeSet & edgesInSpanningForest() override
Returns the edges in a min cost spanning forest.
void _compute_()
Computes the spanning forest.
const EdgeProperty< float > & _costTable_
the costs of the edges
bool _require_computation_
a Boolean indicating whether we need recompute the spanning tree
void _computeInAComponent_(const NodeId id)
compute a spanning tree in a given connected component of graph
float _spanning_tree_cost_
the cost of the spanning tree
void _exploreNode_(const NodeId id)
explore the neighborhood of a node belonging to the spanning tree
~SpanningForestPrim() override
Destructor.
PriorityQueue< Edge, float > _edgesToExplore_
the next edges that may be added to the spanning tree
const UndiGraph & _graph_
the graph the spanning tree of which we wish to compute
SpanningForest()
default constructor
Base class for undirected graphs.
#define GUM_ERROR(type, msg)
Set< Edge > EdgeSet
Some typdefs and define for shortcuts ...
Size NodeId
Type for node ids.
HashTable< Edge, VAL > EdgeProperty
Property on graph elements.
gum is the global namespace for all aGrUM entities
The Prim algorithm for computing min cost spanning trees or forests.