22 if (not closure(i, j)) {
25 for (std::size_t k : row) {
27 if (closure.
m_[k] & col_mask) {
50 M_insist(closure(i, j) == closure(j, i),
"not symmetric");
51 const bool before = closure(i, j);
54 const bool dot = not (row & col).empty();
55 closure(i, j) = closure(j, i) = dot;
56 changed = changed or before != dot;
73 std::size_t source, sink;
76 weighted_edge() =
default;
77 weighted_edge(std::size_t source, std::size_t sink,
double weight)
78 : source(source), sink(sink), weight(weight)
81 bool operator<(
const weighted_edge &other)
const {
return this->weight < other.weight; }
82 bool operator>(
const weighted_edge &other)
const {
return this->weight > other.weight; }
84 std::priority_queue<weighted_edge, std::vector<weighted_edge>, std::greater<weighted_edge>> Q;
89 while (vertices_remaining) {
91 vertices_remaining = vertices_remaining - next_vertex;
98 const std::size_t u = *next_vertex.
begin();
99 for (std::size_t v : N)
100 Q.emplace(u, v, weight(u, v));
109 }
while (not vertices_remaining[E.sink]);
112 M_insist(vertices_remaining[E.sink],
"sink must not yet be in the MSF");
113 vertices_remaining[E.sink] =
false;
114 MSF(E.source, E.sink) = MSF(E.sink, E.source) =
true;
128 while (not V.
empty()) {
131 directed_tree.
m_[v] = this->
m_[v] -
X;
135 return directed_tree;
An adjacency matrix for a given query graph.
AdjacencyMatrix transitive_closure_directed() const
Computes the transitive closure of this adjacency matrix.
std::array< SmallBitset, SmallBitset::CAPACITY > m_
matrix entries
AdjacencyMatrix transitive_closure_undirected() const
Computes the transitive closure of this adjacency matrix.
std::size_t num_vertices_
number of sources of the QueryGraph represented by this matrix
AdjacencyMatrix minimum_spanning_forest(std::function< double(std::size_t, std::size_t)> weight) const
Computes the minimum spanning forest for this graph.
AdjacencyMatrix tree_directed_away_from(SmallBitset root)
Computes an AdjacencyMatrix with all edges directed away from root.
SmallBitset neighbors(SmallBitset S) const
Computes the neighbors of S.
Implements a small and efficient set over integers in the range of 0 to 63 (including).
bool is_singleton() const
static SmallBitset All(std::size_t n)
Factory method for creating a SmallBitset with first n bits set.
bool empty() const
Returns true if there are no elements in this SmallBitset.
static SmallBitset Singleton(std::size_t n)
Factory method for creating a Singleton Smallbitset with n -th bit set.