![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Node-elimination ordering strategy using a priority queue. More...
#include "PermutationStrategy.h"
Classes | |
| struct | node_type |
| Entry in the priority queue. More... | |
Public Member Functions | |
| void | init_permutation (Graph &graph) |
Populate the priority queue with all nodes in graph. | |
| unsigned long | emptyQ () |
| Pop and discard the top node, returning the new queue size. | |
| virtual void | recompute (const std::unordered_set< unsigned long > &nodes, Graph &graph) |
| Recompute statistics for a subset of nodes and update the queue. | |
| unsigned long | get_next () |
| Pop and return the node with the smallest statistic. | |
| unsigned long | get_next_wo_delete () |
| Peek at the node with the smallest statistic (without removing it). | |
| unsigned long | get_second_next_delete () |
| Pop the top node, then pop and return the new top node. | |
| unsigned long | get_second_next () |
| Peek at the node with the second-smallest statistic (no removal). | |
| unsigned long | Q_siz () |
| Return the current number of nodes in the queue. | |
| bool | empty_but1 () |
Return true if the queue contains exactly one node. | |
| bool | empty () |
Return true if the queue is empty. | |
Protected Member Functions | |
| unsigned long | compute_statistic (unsigned long node, Graph &graph) |
Compute the priority statistic for node in graph. | |
Protected Attributes | |
| boost::heap::fibonacci_heap< node_type > | queue |
| The priority queue holding all not-yet-eliminated nodes. | |
| std::unordered_map< unsigned long, boost::heap::fibonacci_heap< node_type >::handle_type > | queue_nodes |
| Maps node IDs to their heap handles for O(1) key updates. | |
Node-elimination ordering strategy using a priority queue.
Maintains a Fibonacci heap of nodes prioritised by a user-defined statistic. The main consumer is TreeDecomposition, which calls init_permutation() once and then repeatedly calls get_next() to obtain the next node to eliminate.
Definition at line 38 of file PermutationStrategy.h.
|
inlineprotected |
Compute the priority statistic for node in graph.
The default implementation returns the degree (number of neighbours) of the node. Override in subclasses to implement other heuristics.
| node | Node whose statistic is needed. |
| graph | Current graph state. |
Definition at line 196 of file PermutationStrategy.h.


|
inline |
Return true if the queue is empty.
true iff no nodes remain. Definition at line 183 of file PermutationStrategy.h.

|
inline |
Return true if the queue contains exactly one node.
true iff exactly one node remains. Definition at line 178 of file PermutationStrategy.h.
|
inline |
Pop and discard the top node, returning the new queue size.
Definition at line 86 of file PermutationStrategy.h.
|
inline |
Pop and return the node with the smallest statistic.
Definition at line 116 of file PermutationStrategy.h.

|
inline |
Peek at the node with the smallest statistic (without removing it).
Definition at line 128 of file PermutationStrategy.h.
|
inline |
Peek at the node with the second-smallest statistic (no removal).
Temporarily pops the top, peeks at the new top, then re-inserts.
Definition at line 160 of file PermutationStrategy.h.
|
inline |
Pop the top node, then pop and return the new top node.
The first (smallest) node is temporarily removed, the second-smallest is popped and returned, and the first is re-inserted.
Definition at line 142 of file PermutationStrategy.h.
|
inline |
Populate the priority queue with all nodes in graph.
Must be called once before any calls to get_next().
| graph | The graph whose nodes should be enqueued. |
Definition at line 72 of file PermutationStrategy.h.


|
inline |
Return the current number of nodes in the queue.
Definition at line 173 of file PermutationStrategy.h.
|
inlinevirtual |
Recompute statistics for a subset of nodes and update the queue.
Called after a node is eliminated to refresh the priorities of its former neighbours.
| nodes | Set of node IDs whose statistics need updating. |
| graph | The current (modified) graph. |
Definition at line 103 of file PermutationStrategy.h.


|
protected |
The priority queue holding all not-yet-eliminated nodes.
Definition at line 59 of file PermutationStrategy.h.
|
protected |
Maps node IDs to their heap handles for O(1) key updates.
Definition at line 62 of file PermutationStrategy.h.