105 for (
const auto node:
_graph_.nodes()) {
155 for (
const auto node:
_graph_.neighbours(
id)) {
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.
UndiGraph _spanning_tree_
the computed spanning tree
SpanningForestPrim(const UndiGraph *graph, const EdgeProperty< float > *costTable)
Default constructor.
float costOfSpanningForest()
Returns the cost of the spanning forest.
void _compute_()
Computes the spanning forest.
const EdgeProperty< float > & _costTable_
the costs of the edges
const EdgeSet & edgesInSpanningForest()
Returns the edges in a min cost spanning forest.
bool _require_computation_
a Boolean indicating whether we need recompute the spanning tree
const UndiGraph & spanningForest()
Construct the spanning forest.
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
virtual ~SpanningForestPrim()
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.