5 #ifndef BALL_DATATYPE_GRAPH_TREEWIDTH_H
6 #define BALL_DATATYPE_GRAPH_TREEWIDTH_H
8 #ifndef BALL_COMMON_GLOBAL_H
12 #ifndef BALL_COMMON_EXCEPTION_H
16 #ifndef BALL_CONCEPT_BASEFUNCTOR_H
20 #ifndef BALL_DATATYPE_GRAPH_GRAPHALGORITHMS_H
24 #ifndef BALL_DATATYPE_GRAPH_MOLECULARGRAPH_H
35 #include <boost/graph/connected_components.hpp>
36 #include <boost/graph/filtered_graph.hpp>
37 #include <boost/graph/graph_as_tree.hpp>
38 #include <boost/graph/graphviz.hpp>
39 #include <boost/graph/copy.hpp>
58 template <
class UndirectedGraph>
101 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
102 boost::property<boost::vertex_bag_content_t, std::set<OriginalVertexType>,
104 boost::property<boost::vertex_bag_type_t, int> > >,
109 typedef boost::iterator_property_map<typename std::vector<TreeDecompositionBag>::iterator,
110 typename boost::property_map<TreeDecompositionGraph, boost::vertex_index_t>::type>
112 typedef boost::graph_as_tree<TreeDecompositionGraph, TreeDecompositionParentMap>
TreeDecomposition;
130 template <
typename ComponentMap>
139 template <
typename Vertex>
176 template <
class UndirectedGraph>
181 typedef typename boost::graph_traits<UndirectedGraph>::vertex_descriptor
VertexType;
183 typedef typename boost::graph_traits<UndirectedGraph>::vertex_iterator
VertexIterator;
203 template<
class Criterion,
class Reducer>
286 template<
class Criterion>
288 :
public UnaryFunctor<UndirectedGraph, typename std::pair<
289 std::vector<boost::graph_traits<typename UndirectedGraph::vertex_descriptor> >, Size> >
315 template <
class Lowerbound=MinorMinW
idth,
class Upperbound=GreedyX<FillInHeuristic> >
334 QuickBB(UndirectedGraph
const& graph);
370 typedef std::map<VertexType, bool>
BitSet;
372 typedef std::pair<typename GraphMap::iterator, bool>
MapPos;
447 template <
class OriginalGraphType>
476 boost::shared_ptr<TreeDecomposition>
makeNice(boost::shared_ptr<TreeDecompositionGraph>& nice_tree);
479 typename std::vector<TreeDecompositionBag>::iterator c_i,
typename std::vector<TreeDecompositionBag>::iterator c_end);
496 typename std::vector<TreeDecompositionBag>::iterator begin,
497 typename std::vector<TreeDecompositionBag>::iterator end);
499 boost::shared_ptr<TreeDecomposition>
tree_;
509 #include <BALL/DATATYPE/GRAPH/treeWidth.iC>
511 #endif // BALL_DATATYPE_GRAPH_TREEWIDTH_H
TreeDecompositionBag buildRoot_(TreeDecompositionBag child)
Generic lower bound algorithm on graphs.
MinorMinWidthReducer(UndirectedGraph &graph)
std::pair< BitSet, Size > MapEntry
UndirectedGraph const * original_graph_
std::vector< boost::shared_ptr< TreeDecomposition > > nice_tree_decompositions_
TreeWidth< OriginalGraphType >::OriginalVertexType OriginalVertexType
Size operator()(VertexType &vertex) const
TreeDecompositionBag linkWithIntroduceNodes_(TreeDecompositionContent parent_set, TreeDecompositionBag child)
TreeDecompositionBag buildSingle_(TreeDecompositionBag node, int node_type, TreeDecompositionBag child)
std::map< VertexType, bool > BitSet
boost::shared_ptr< TreeDecompositionGraph > tree_graph_
SIMPLICIAL_TYPE isSimplicial(VertexType &vertex) const
boost::shared_ptr< TreeDecomposition > makeNice(boost::shared_ptr< TreeDecompositionGraph > &nice_tree)
Size edgeIncreaseByEliminating(VertexIterator vertex, UndirectedGraph &graph)
std::set< OriginalVertexType > TreeDecompositionContent
TreeWidth< OriginalGraphType >::TreeDecompositionGraph TreeDecompositionGraph
boost::graph_traits< UndirectedGraph >::vertex_descriptor VertexType
std::vector< Size > permutation
std::set< OriginalVertexType > TreeDecompositionContent
GraphMap visitedSubgraphs
VertexType & operator()(UndirectedGraph &graph)
BitSet buildBitset() const
boost::iterator_property_map< typename std::vector< TreeDecompositionBag >::iterator, typename boost::property_map< TreeDecompositionGraph, boost::vertex_index_t >::type > TreeDecompositionParentMap
std::vector< boost::shared_ptr< TreeDecompositionGraph > > nice_tree_decomposition_graphs_
boost::graph_traits< UndirectedGraph >::vertex_iterator VertexIterator
TreeWidth(UndirectedGraph const &input)
std::pair< typename GraphMap::iterator, bool > MapPos
std::pair< std::vector< Size >, Size > EliminationOrder
boost::graph_as_tree< TreeDecompositionGraph, TreeDecompositionParentMap > TreeDecomposition
std::vector< boost::shared_ptr< TreeDecomposition > > & getNiceTreeDecompositions()
BagContentWriter(TreeDecomposition const *td, UndirectedGraph const *original_graph)
virtual Size operator()(UndirectedGraph const &originalGraph)
TreeDecompositionBag root_
void contractEdge(VertexType &u, VertexType &v)
boost::shared_ptr< TreeDecomposition > tree_
ComponentFilter_(ComponentMap cm, Position i)
MinorMinWidthCriterion(UndirectedGraph const &graph)
boost::graph_traits< UndirectedGraph >::vertex_descriptor OriginalVertexType
boost::shared_ptr< TreeDecomposition > operator()(UndirectedGraph const &graph, EliminationOrder const &permutation)
TreeDecompositionBag buildJoin_(TreeDecompositionBag node, TreeDecompositionBag left, TreeDecompositionBag right, bool do_forget)
boost::shared_ptr< TreeDecompositionGraph > nice_tree_
std::vector< boost::shared_ptr< EditableGraph > > components_
TreeWidth< OriginalGraphType >::TreeDecomposition TreeDecomposition
void branchAndBound(QuickBBState &nstate)
GeneralLowerBoundAlgorithm()
TreeDecompositionBag linkWithForgetNodes_(TreeDecompositionContent parent_set, TreeDecompositionBag child)
void operator()(VertexType &vertex)
TreeDecompositionBag buildLeaf_(TreeDecompositionBag child)
boost::graph_traits< TreeDecompositionGraph >::vertex_descriptor TreeDecompositionBag
TreeWidth< OriginalGraphType >::TreeDecompositionBag TreeDecompositionBag
EliminationOrder compute()
static Size computeTreeWidth(TreeDecomposition const &td)
GRAPH::GraphTraits< UndirectedGraph >::EditableGraph EditableGraph
std::map< BitSet, Size > GraphMap
std::map< int, VertexType > index_to_vertex_
boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::property< boost::vertex_bag_content_t, std::set< OriginalVertexType >, boost::property< boost::vertex_bag_special_t, OriginalVertexType, boost::property< boost::vertex_bag_type_t, int > > >, boost::no_property > TreeDecompositionGraph
bool operator()(const Vertex &e) const
MolecularGraph const * input_
GeneralLowerBoundAlgorithm< MinorMinWidthCriterion, MinorMinWidthReducer > MinorMinWidth
void writeGraphvizFile(std::ostream &out, TreeDecomposition const &td)
EliminationOrder operator()(UndirectedGraph &original_graph)
std::vector< boost::shared_ptr< EditableGraph > > & getComponents()
TreeDecomposition const * td_
BOOST_INSTALL_PROPERTY(vertex, atom_ptr)
TreeDecompositionBag branch_(TreeDecompositionBag node, int node_type, typename std::vector< TreeDecompositionBag >::iterator begin, typename std::vector< TreeDecompositionBag >::iterator end)
void prune(QuickBBState &)
GreedyX< FillInHeuristic > GreedyFillIn
TreeDecompositionBag buildLinkage_(TreeDecompositionBag node, TreeDecompositionBag child)
UndirectedGraph const & graph_
boost::graph_traits< UndirectedGraph >::adjacency_iterator NeighbourIterator
QuickBB(UndirectedGraph const &graph)
EliminationOrder own_solution
boost::adjacency_list< boost::listS, boost::listS, boost::undirectedS, boost::property< boost::vertex_orig_ptr_t, VertexType, boost::property< boost::vertex_index_t, int > >, boost::property< boost::edge_orig_ptr_t, EdgeType > > EditableGraph
void operator()(std::ostream &out, const TreeDecompositionBag &v) const
EliminationOrder greedy_solution