souffle
2.0.2-371-g6315b36
|
#include <Index.h>
Public Types | |
using | Distance = int |
using | Matchings = std::unordered_map< Node, Node > |
Matching represent a solution of the matching, i.e., which node in the bi-partite graph maps to another node. More... | |
using | Node = uint32_t |
using | Nodes = std::unordered_set< Node > |
Public Member Functions | |
void | addEdge (Node u, Node v) |
@Brief add an edge to the bi-partite graph More... | |
int | getNumMatchings () const |
@Brief get number of matches in the solution More... | |
const Matchings & | solve () |
@Brief solve the maximum matching problem More... | |
Data Fields | |
const Distance | InfiniteDistance = -1 |
const Node | NullVertex = 0 |
Protected Member Functions | |
bool | bfSearch () |
@Brief perform a breadth first search in the graph More... | |
bool | dfSearch (Node u) |
@Brief perform a depth first search in the graph More... | |
Distance | getDistance (Node v) |
@Brief get distance of a node More... | |
Node | getMatch (Node v) |
@Brief get match for a search signature More... | |
Private Types | |
using | DistanceMap = std::map< Node, Distance > |
distance function of nodes More... | |
using | Edges = std::unordered_set< Node > |
Edges in the bi-partite graph. More... | |
using | Graph = std::unordered_map< Node, Edges > |
Bi-partite graph of instance. More... | |
Private Attributes | |
DistanceMap | distance |
Graph | graph |
Matchings | match |
@Brief Computes a maximum matching with Hopcroft-Karp algorithm
This class is a helper class for RamIndex.
This implements a standard maximum matching algorithm for a bi-partite graph also known as a marriage problem. Given a set of edges in a bi-partite graph select a subset of edges that each node in the bi-partite graph has at most one adjacent edge associated with.
The nodes of the bi-partite graph represent index-signatures stemming from RAM operations and RAM existence checks for a relation. A relation between two nodes represent whether an index operation subsumes another operation.
Source: http://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm#Pseudocode
using souffle::ram::analysis::MaxMatching::Distance = int |
|
private |
|
private |
|
private |
using souffle::ram::analysis::MaxMatching::Matchings = std::unordered_map<Node, Node> |
using souffle::ram::analysis::MaxMatching::Node = uint32_t |
using souffle::ram::analysis::MaxMatching::Nodes = std::unordered_set<Node> |
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
const MaxMatching::Matchings & souffle::ram::analysis::MaxMatching::solve | ( | ) |
@Brief solve the maximum matching problem
Definition at line 248 of file Index.cpp.
References dfSearch(), getMatch(), and NullVertex.
|
private |
const Distance souffle::ram::analysis::MaxMatching::InfiniteDistance = -1 |
|
private |
Definition at line 190 of file Index.h.
Referenced by getNumMatchings().
const Node souffle::ram::analysis::MaxMatching::NullVertex = 0 |