62 template <
typename GUM_SCALAR >
66 template <
typename GUM_SCALAR >
76 template <
typename GUM_SCALAR >
124 std::list< NodeId >&
roots();
127 const std::list< NodeId >&
roots()
const;
303#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Inline implementation of the DFSTree class.
Set of pairs of elements with fast search for both elements.
DiGraph(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size arcs_size=HashTableConst::default_size, bool arcs_resize_policy=true)
default constructor
The class for generic Hash Tables.
The generic class for storing (ordered) sequences of objects.
Base class for undirected graphs.
This class discovers pattern in a PRM<GUM_SCALAR>'s PRMSystem<GUM_SCALAR> to speed up structured infe...
Abstract class representing an element of PRM class.
An PRMInstance is a Bayesian network fragment defined by a Class and used in a PRMSystem.
A DFSTree is used by gspan to sort lexicographically patterns discovered in an interface graph.
Set< NodeId > & max_indep_set(const Pattern &p)
Returns the maximal independent set of p isomorphism graph.
Pattern & pattern(NodeId id)
Returns the pattern represented by id in this DFSTree.
std::list< NodeId > & children(const Pattern &p)
Returns the list of p children in this DFSTree.
const InterfaceGraph< GUM_SCALAR > & graph() const
Returns the list of root patterns in this DFSTree.
SearchStrategy< GUM_SCALAR > * _strategy_
The strategy used to prune the search tree.
void _checkGrowth_(Pattern &p, Pattern *child, EdgeGrowth< GUM_SCALAR > &edge_growth)
Raise different exceptions if child is invalid or illegal.
std::list< NodeId > & roots()
Returns the list of root patterns in this DFSTree.
bool _test_equality_(HashTable< PRMClassElement< GUM_SCALAR > *, Size > &x, HashTable< PRMClassElement< GUM_SCALAR > *, Size > &y)
Pattern & parent(const Pattern &p)
Returns the parent of p in this DFSTree.
PatternData & data(const Pattern &p)
UndiGraph & iso_graph(const Pattern &p)
Returns the isomorphism graph of p in the interface graph.
void addRoot(LabelData &data)
Add a one edge Pattern in this DFSTree.
Sequence< PRMInstance< GUM_SCALAR > * > & iso_map(const Pattern &p, NodeId node)
Given a pattern and a node in its isomorphism graph, this methods returns the sequence of instance ma...
Pattern & growPattern(Pattern &p, EdgeGrowth< GUM_SCALAR > &edge_growth, Size min_freq)
Add a one edge growth of p as one of its child.
void _addChild_(Pattern &p, Pattern *child, EdgeGrowth< GUM_SCALAR > &edge_growth)
Add a child to this DFSTree.
void _initialiaze_root_(Pattern *p, Sequence< EdgeData< GUM_SCALAR > * > &seq)
This initialize the DSFTree with a new root.
HashTable< Pattern *, PatternData * > _data_
Data about patterns in this DFSTree.
bool _is_new_seq_(Sequence< PRMInstance< GUM_SCALAR > * > &seq, NodeProperty< Sequence< PRMInstance< GUM_SCALAR > * > * > &iso_map)
Check if an instance match is redundant.
double frequency(const Pattern &p) const
Returns the frequency of p respecting it's maximal independent set.
SearchStrategy< GUM_SCALAR > & strategy()
strategy getter
Bijection< NodeId, Pattern * > _node_map_
The mapping between nodes in this DFSTree and the patterns they represents.
const InterfaceGraph< GUM_SCALAR > * _graph_
The interface graph on which this DFSTree applies.
std::list< NodeId > _roots_
The list of root patterns in this DFSTree.
DFSTree(const InterfaceGraph< GUM_SCALAR > &graph, SearchStrategy< GUM_SCALAR > *strategy=0)
Default constructor.
Inner class to handle data about edges in graph.
This class is used to define an edge growth of a pattern in this DFSTree.
This class represent the interface graph of a given gum::prm::PRMSystem<GUM_SCALAR>.
This contains all the information we want for a node in a DFSTree.
This is an abstract class used to tune search strategies in the gspan algorithm.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities
Headers of the SearchStrategy class and child.
~NeighborDegreeSort()
Destructor.
NeighborDegreeSort(UndiGraph &graph)
Constructor.
bool operator()(NodeId i, NodeId j)
The operator used to sort stuff.
UndiGraph & g
The isomorphism graph.
~PatternData()
Destructor.
Pattern * pattern
The pattern.
Size cost
The cost of this Pattern.
Size gain
The gain of this Pattern.
NodeProperty< Sequence< PRMInstance< GUM_SCALAR > * > * > iso_map
The instances matching p in the interface graph.
UndiGraph iso_graph
The isomorphism graph of the pattern.
PatternData(Pattern *p)
Constructor.
Set< NodeId > max_indep_set
The maximal independent set of p.
std::list< NodeId > children
The list of the pattern's children, sorted lexicographically.
Inner class to handle data about labels in this interface graph.