![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Mutable adjacency-list graph over unsigned-long node IDs. More...
#include "Graph.h"
Public Member Functions | |
| Graph (const BooleanCircuit &bc) | |
Construct the primal graph of a BooleanCircuit. | |
| void | add_edge (unsigned long src, unsigned long tgt, bool undirected=true) |
Add an edge between src and tgt. | |
| void | add_node (unsigned long node) |
Add node to the graph (no edges). | |
| std::unordered_set< unsigned long > | remove_node (unsigned long node) |
Remove node and all its incident edges. | |
| bool | neighbour_improved (unsigned k, unsigned long n1, unsigned long n2) |
Test whether two nodes share more than k-1 common neighbours. | |
| void | fill (const std::unordered_set< unsigned long > &nodes, bool undirected=true) |
Add all missing edges within nodes (clique fill). | |
| void | contract_edge (unsigned long src, unsigned long tgt) |
Contract the edge (src, tgt) by merging tgt into src. | |
| bool | has_neighbours (unsigned long node) const |
Return true if node has any adjacent edges. | |
| bool | has_node (unsigned long node) const |
Return true if node is present in the graph. | |
| bool | has_edge (unsigned long src, unsigned long tgt) |
Return true if a directed edge from src to tgt exists. | |
| const std::unordered_set< unsigned long > & | get_neighbours (unsigned long node) const |
Return the neighbour set of node. | |
| const std::unordered_set< unsigned long > & | get_nodes () const |
| Return the set of all node IDs in the graph. | |
| unsigned long | number_nodes () const |
| Return the number of nodes in the graph. | |
| unsigned long | number_edges () const |
| Return the number of edges in the graph. | |
Private Attributes | |
| std::unordered_map< unsigned long, std::unordered_set< unsigned long > > | adj_list |
| Adjacency lists. | |
| std::unordered_set< unsigned long > | node_set |
| Set of all node IDs. | |
| unsigned long | num_edges = 0 |
| Current edge count. | |
Mutable adjacency-list graph over unsigned-long node IDs.
Supports both directed and undirected edges, node/edge removal, clique-fill operations, and edge contraction, as needed by the min-fill tree-decomposition algorithm.
|
inline |
Construct the primal graph of a BooleanCircuit.
Each gate (except UNDETERMINED and MULVAR) becomes a node. Each wire between two gates becomes an undirected edge.
| bc | The Boolean circuit whose structure defines the graph. |
Definition at line 48 of file Graph.h.

|
inline |
Add an edge between src and tgt.
If the edge already exists the call is a no-op. Both endpoint nodes are added to node_set if not already present.
| src | Source node. |
| tgt | Target node. |
| undirected | If true, also add the reverse edge. |
Definition at line 72 of file Graph.h.


|
inline |
|
inline |
|
inline |
Add all missing edges within nodes (clique fill).
Connects every pair of nodes in nodes that is not already connected, making the subgraph induced by nodes into a clique.
| nodes | Set of node IDs to fill. |
| undirected | If true, add edges in both directions. |
Definition at line 152 of file Graph.h.


|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Test whether two nodes share more than k-1 common neighbours.
Used by the min-fill heuristic to decide whether eliminating a node improves the treewidth bound.
| k | Treewidth bound being tested. |
| n1 | First node. |
| n2 | Second node. |
true if the common-neighbour count exceeds k-1. Definition at line 119 of file Graph.h.

|
inline |
|
inline |
|
inline |
|
private |
|
private |
|
private |