39 __graph(*graph), __costTable(*cost), __spanning_tree_cost(0),
40 __require_computation(true) {
41 if (!graph || !cost) {
NodeId second() const
returns the node ID of the other extremal node ID
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
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.
virtual void addEdge(const NodeId first, const NodeId second)
insert a new edge into the undirected graph
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const EdgeSet & edgesInSpanningForest()
Returns the edges in a min cost spanning forest.
The class for generic Hash Tables.
const NodeSet & neighbours(const NodeId id) const
returns the set of edges adjacent to a given node
float costOfSpanningForest()
Returns the cost of the spanning forest.
const EdgeSet & edges() const
returns the set of edges stored within the EdgeGraphPart
NodeId first() const
returns one extremal node ID (whichever one it is is unspecified)
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
virtual ~SpanningForestPrim()
Destructor.
bool existsNode(const NodeId id) const
returns true iff the NodeGraphPart contains the given nodeId
The base class for all undirected edges.
void __exploreNode(const NodeId id)
explore the neighborhood of a node belonging to the spanning tree
Base class for undirected graphs.
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.
#define GUM_ERROR(type, msg)
bool __require_computation
a Boolean indicating whether we need recompute the spanning tree