38 #include <agrum/tools/core/timer.h> 40 #include <agrum/BN/inference/variableElimination.h> 42 #include <agrum/PRM/PRM.h> 43 #include <agrum/PRM/gspan/DFSTree.h> 44 #include <agrum/PRM/gspan/interfaceGraph.h> 69 template <
typename GUM_SCALAR >
85 GSpan(
const PRM< GUM_SCALAR >& prm,
86 const PRMSystem< GUM_SCALAR >& sys,
87 gspan::SearchStrategy< GUM_SCALAR >* strategy = 0);
103 Size getMaxDFSDepth()
const;
111 void setMaxDFSDepth(Size depth);
117 gspan::DFSTree< GUM_SCALAR >& tree();
123 const gspan::DFSTree< GUM_SCALAR >& tree()
const;
129 gspan::InterfaceGraph< GUM_SCALAR >& interfaceGraph();
135 const gspan::InterfaceGraph< GUM_SCALAR >& interfaceGraph()
const;
150 void discoverPatterns();
158 std::vector< gspan::Pattern* >& patterns();
166 const std::vector< gspan::Pattern* >& patterns()
const;
169 typedef Set< Sequence< PRMInstance< GUM_SCALAR >* >* > MatchedInstances;
177 MatchedInstances& matches(
const gspan::Pattern& p);
185 const MatchedInstances& matches(
const gspan::Pattern& p)
const;
215 gspan::InterfaceGraph< GUM_SCALAR >* _graph_;
218 gspan::DFSTree< GUM_SCALAR > _tree_;
224 std::vector< gspan::Pattern* > _patterns_;
227 std::vector< gspan::LabelData* > _nodes_;
230 std::vector< gspan::LabelData* > _edges_;
233 HashTable< gspan::LabelData*, Idx > _cost_;
237 HashTable< gspan::Pattern*, MatchedInstances* > _matched_instances_;
240 Set< PRMInstance< GUM_SCALAR >* > _chosen_;
249 void _sortNodesAndEdges_();
254 void _subgraph_mining_(gspan::InterfaceGraph< GUM_SCALAR >& graph, gspan::Pattern& p);
261 Size _cost_func_(Size interface_size, Size frequency);
264 void _sortPatterns_();
269 bool _isEdgeEligible_(
typename gspan::EdgeData< GUM_SCALAR >* e);
288 LabelSort(GSpan* my_gspan);
294 LabelSort(
const LabelSort& source);
307 bool operator()(gspan::LabelData* i, gspan::LabelData* j);
323 PatternSort(GSpan* my_gspan);
329 PatternSort(
const PatternSort& source);
342 bool operator()(gspan::Pattern* i, gspan::Pattern* j);
352 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 353 extern template class GSpan<
double >;
360 #include <agrum/PRM/inference/gspan_tpl.h>