23#ifndef PermutationStrategy_h
24#define PermutationStrategy_h
26#include <boost/heap/fibonacci_heap.hpp>
59 boost::heap::fibonacci_heap<node_type>
queue;
61 std::unordered_map<
unsigned long,
62 boost::heap::fibonacci_heap<node_type>::handle_type>
queue_nodes;
89 unsigned long node_id = nstruct_temp.
id;
103 virtual void recompute(
const std::unordered_set<unsigned long> &nodes,
Graph& graph){
104 for(
auto node:nodes){
118 unsigned long node_id = nstruct.
id;
130 unsigned long node_id = nstruct.
id;
146 unsigned long node_id = nstruct.
id;
149 queue.push(nstruct_temp);
164 unsigned long node_id = nstruct.
id;
165 queue.push(nstruct_temp);
Undirected graph used in tree-decomposition computations.
Mutable adjacency-list graph over unsigned-long node IDs.
const std::unordered_set< unsigned long > & get_nodes() const
Return the set of all node IDs in the graph.
bool has_neighbours(unsigned long node) const
Return true if node has any adjacent edges.
const std::unordered_set< unsigned long > & get_neighbours(unsigned long node) const
Return the neighbour set of node.
Node-elimination ordering strategy using a priority queue.
unsigned long get_next()
Pop and return the node with the smallest statistic.
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_second_next_delete()
Pop the top node, then pop and return the new top node.
boost::heap::fibonacci_heap< node_type > queue
The priority queue holding all not-yet-eliminated nodes.
unsigned long emptyQ()
Pop and discard the top node, returning the new queue size.
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.
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.
unsigned long compute_statistic(unsigned long node, Graph &graph)
Compute the priority statistic for node in graph.
bool empty()
Return true if the queue is empty.
unsigned long get_second_next()
Peek at the node with the second-smallest statistic (no removal).
unsigned long get_next_wo_delete()
Peek at the node with the smallest statistic (without removing it).
void init_permutation(Graph &graph)
Populate the priority queue with all nodes in graph.
Entry in the priority queue.
unsigned long val
Priority statistic (smaller ⇒ higher priority)
bool operator<(const node_type &a) const
Compare two entries; lower val (or lower id on tie) wins.
unsigned long id
Node identifier.