mc2lib
|
#include <sets.hpp>
Classes | |
class | R_impl |
Public Types | |
typedef Ts::Element | Element |
typedef Ts::template MapContainer< Set< Ts > > | Container |
typedef std::pair< Element, Element > | Tuple |
typedef std::vector< Element > | Path |
typedef unsigned | Properties |
Public Member Functions | |
Relation () | |
Relation (Container r) | |
const Container & | get () const |
Properties | props () const |
Relation & | set_props (Properties props) |
Relation & | add_props (Properties props) |
Relation & | unset_props (Properties props) |
bool | all_props (Properties all) const |
bool | any_props (Properties any) const |
Properties | clear_props () |
void | Insert (const Element &e1, const Element &e2, bool assert_unique=false) |
void | Insert (const Element &e1, Element &&e2, bool assert_unique=false) |
void | Insert (const Element &e1, const Set< Ts > &e2s) |
void | Insert (const Element &e1, Set< Ts > &&e2s) |
bool | Erase (const Element &e1, const Element &e2, bool assert_exists=false) |
void | Erase (const Element &e1, const Set< Ts > &e2s) |
std::size_t | size () const |
template<class Func > | |
Func | for_each (Func func) const |
Relation | Eval () const |
Relation & | EvalInplace () |
template<class FilterFunc > | |
Relation | Filter (FilterFunc filterFunc) const |
Relation | Inverse () const |
Relation & | operator|= (const Relation &rhs) |
Relation & | operator-= (const Relation &rhs) |
Relation & | operator &= (const Relation &rhs) |
void | Clear () |
bool | empty () const |
bool | operator== (const Relation &rhs) const |
bool | operator!= (const Relation &rhs) const |
bool | R (const Element &e1, const Element &e2, Path *path=nullptr) const |
Set< Ts > | Reachable (const Element &e) const |
bool | Irreflexive (Path *cyclic=nullptr) const |
bool | Acyclic (Path *cyclic=nullptr) const |
bool | Transitive () const |
bool | TotalOn (const Set< Ts > &on) const |
bool | ConnexOn (const Set< Ts > &on) const |
bool | WeakPartialOrder (const Set< Ts > &on) const |
bool | WeakTotalOrder (const Set< Ts > &on) const |
bool | StrictPartialOrder (const Set< Ts > &on) const |
bool | StrictTotalOrder (const Set< Ts > &on) const |
bool | InOn (const Element &e) const |
bool | InDomain (const Element &e) const |
bool | InRange (const Element &e) const |
Set< Ts > | On () const |
Set< Ts > | Domain () const |
Set< Ts > | Range () const |
bool | SubsetEq (const Relation &rhs) const |
bool | Subset (const Relation &rhs) const |
Static Public Attributes | |
static constexpr Properties | kNone = 0x0 |
static constexpr Properties | kTransitiveClosure = 0x1 |
static constexpr Properties | kReflexiveClosure = 0x2 |
static constexpr Properties | kReflexiveTransitiveClosure |
Protected Types | |
enum | SearchMode { SearchMode::kRelated, SearchMode::kRelatedVisitAll, SearchMode::kFindCycle } |
typedef Ts::template MapContainer< bool > | FlagSet |
Protected Member Functions | |
bool | Contains__ (const Element &e) const |
void | GetPath (Path *out, const Element *start, const Element *end, FlagSet *visiting, SearchMode mode=SearchMode::kRelated) const |
bool | Irreflexive (Properties local_props, Path *cyclic) const |
bool | R_search (const Element &e1, const Element *e2, Set< Ts > *visited, FlagSet *visiting=nullptr, Properties local_props=kNone, SearchMode mode=SearchMode::kRelated) const |
Protected Attributes | |
Properties | props_ |
Container | rel_ |
typedef Ts::template MapContainer<Set<Ts> > mc2lib::sets::Relation< Ts >::Container |
typedef Ts::Element mc2lib::sets::Relation< Ts >::Element |
|
protected |
typedef std::vector<Element> mc2lib::sets::Relation< Ts >::Path |
typedef unsigned mc2lib::sets::Relation< Ts >::Properties |
Lazy operators as properties.
All in-place operators (e.g. |=) evaluate the current relation in place and clear properties.
typedef std::pair<Element, Element> mc2lib::sets::Relation< Ts >::Tuple |
|
strongprotected |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
∀(x,y) ∈ on×on, x→y ∨ y→x ∨ x=y
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Evaluated view of the relation, with properties evaluated.
|
inline |
Evaluate all properties in-place.
|
inline |
|
inline |
Iterates over each tuple in the relation (uses properties).
func | A function taking two parameters of type Element. |
|
inline |
Avoid accessing underlying container directly if possible! Uses of get() should be justified.
|
inlineprotected |
Get path from start to end.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
Check that relation is irreflexive.
local_props | Call specific properties. |
cyclic | Optional parameter, in which the cycle is returned, if result is false. |
|
inline |
|
inline |
Relation intersection
|
inline |
|
inline |
Relation difference.
|
inline |
|
inline |
Relation union.
|
inline |
|
inline |
Check if (e1, e2) is in the relation. This effectively does a search if there is an edge from e1 to e2.
e1 | first element. |
e2 | second element |
path | Optional; return path from e1 to e2. |
|
inlineprotected |
Check if two elements are related, i.e. there exists an edge or path from e1 to e2. This is implemented as a directed graph search.
e1 | First element. |
e2 | Second element. |
visited | Visited element (node) set. |
visiting | Currently visiting elements (nodes). |
local_props | Call specific properties. |
mode | Search mode. |
|
inline |
|
inline |
Returns all rechable elements from a start element without the start itself, but includes start if start can reach itself (e.g. through cycle).
e | Start element. |
|
inline |
|
inline |
Total size of the relation (i.e. number of tuples or edges); uses properties.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
∀(x,y) ∈ on×on, x→y ∨ y→x
|
inline |
x→y ∧ y→z ⇒ x→z
|
inline |
|
inline |
|
inline |
|
static |
|
static |
|
static |
|
static |
|
protected |
|
protected |