Container aiding in gradual discovery of order. More...
#include <OrderDiscoveryHelper.h>
Data Structures | |
class | GraphvizWriter |
struct | VertexData |
Public Types | |
using | DependencyGraphType = boost::adjacency_list< boost::setS, boost::vecS, boost::directedS, VertexData > |
using | VertexIndexType = typename DependencyGraphType::vertex_descriptor |
Public Member Functions | |
template<typename Container > | |
OrderDiscoveryHelper (const Container &container) | |
Arbitrary container constructor. More... | |
void | addRelationshipsFromOther (const OrderDiscoveryHelper &other) |
Transfer relationships from another OrderDiscoveryHelper. More... | |
void | addAllFromOther (const OrderDiscoveryHelper &other) |
Adds vertices and edges from another instance, then adds transferability edges. More... | |
void | addTransferabilityEdges () |
Adds missing transferability edges. More... | |
template<typename It > | |
void | setUnorderedValues (It iter, const It end) |
Range-abstracted. More... | |
template<typename Container > | |
void | setUnorderedValues (Container &&container) |
Container-abstracted. More... | |
std::vector< std::vector< T > > | getSets () const |
Get a list of sets (in descending order) as currently discovered. More... | |
std::vector< std::vector< T > > | getUndecidedSets () const |
Returns grouped data (in descending order) whose internal order is undecided. More... | |
bool | isTotallyOrdered () const |
Returns whether the total order has been discovered or not. More... | |
void | addLessThanRelationship (const T &a, const T &b) |
Add a less-than relationship to the graph. More... | |
std::string | dumpGraphviz () const |
Dumps a graphviz string for visualization of relationships. More... | |
bool | isSmaller (const T &a, const T &b) const |
Check if a value is smaller than another. More... | |
Private Member Functions | |
std::vector< std::vector< T > > | getSetsByDegree_ () const |
Get a grouped list of the ordered data sorted by out_degree ascending. More... | |
VertexIndexType | addItem_ (const T &item) |
Private Attributes | |
std::map< T, VertexIndexType > | sourceMap_ |
DependencyGraphType | graph_ |
Container aiding in gradual discovery of order.
T | The type whose order is to be discovered |
|
inlineexplicit |
Arbitrary container constructor.
Container | Container type |
container | Container instance |
Complexity \(\Theta(N)\)
|
inline |
Adds vertices and edges from another instance, then adds transferability edges.
Adds all information present in another OrderDiscoveryHelper that are not yet present in this one. Any vertices not present in this graph are added, plus any missing relationship edges. If any contradictory information is present, this function throws. Missing transferability edges are added too (if a < b && b < c, then a < c).
Complexity \(O(N^2)\)
|
inline |
Add a less-than relationship to the graph.
Complexity \(\Theta(1)\)
|
inline |
Transfer relationships from another OrderDiscoveryHelper.
Adds any relationships from another OrderDiscoveryHelper that are not yet present in this instance. No new vertices are added. Missing transferability edges are added (if a < b && b < c, then a < c) If any contradictory information is present, this function throws.
Complexity \(\Theta(N^2)\)
|
inline |
Adds missing transferability edges.
Adds any missing transferability edges (if a < b && b < c, then a < c).
Complexity \(O(N^2)\)
This function is awful in terms of complexity, it's worst case of O(N²). There must be better ways of doing this.
|
inline |
Dumps a graphviz string for visualization of relationships.
Complexity \(\Theta(N)\)
|
inline |
Get a list of sets (in descending order) as currently discovered.
Complexity \(\Theta(N)\)
|
inlineprivate |
Get a grouped list of the ordered data sorted by out_degree ascending.
Complexity \(\Theta(N)\)
|
inline |
Returns grouped data (in descending order) whose internal order is undecided.
Complexity \(\Theta(N)\)
|
inline |
Check if a value is smaller than another.
This returns true if and only if both values are part of the graph and if the less-than relationship is present in the order given, i.e. a < b.
In all other cases (either of the values isn't in the graph, there is no ordering relationship or the ordering relationship is the other way around), this function returns false.
Complexity \(\Theta(1)\)
|
inline |
Returns whether the total order has been discovered or not.
Complexity \(\Theta(1)\)
|
inline |
|
inline |