BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
UCK.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_STRUCTURE_UCK_H
6 #define BALL_STRUCTURE_UCK_H
7 
8 #ifndef BALL_DATATYPE_STRING_H
9  #include <BALL/DATATYPE/string.h>
10 #endif
11 
12 #include <vector>
13 
14 namespace BALL
15 {
16  class Molecule;
17 
23  {
24  public:
25 
28  typedef std::vector<std::pair<Size, Size> > PairVector;
29  typedef std::vector<std::vector<Size> > SizeVector;
31 
32  /* default constructor
33  */
34  UCK();
35 
36  /* constructor
37  */
38  UCK(const Molecule& mol, Size d=3);
39 
40  /* copy constructor
41  */
42  UCK(UCK& uck);
43 
44  /* destructor
45  */
46  virtual ~UCK();
47 
48  /* print Uck to std::out
49  */
50  void printUCK(std::ostream& outstr);
51 
52  Size getDepth();
53 
54  const String& getFormula() const;
55 
56  const String& getUCK() const;
57 
58  const String& getId() const;
59 
60  float getWeight();
61 
62  private:
63 
64  /* variation of UCK-Algorithm:
65  * delete one occurance of the current label from the lambda string
66  * this reduces the length of the constructed string
67  */
68  String eraseDoubleLabels(const Size d, String x, String label);
69 
70  /* computes the uck
71  */
72  void makeUCK(const Molecule& m);
73 
74  /* construct graph-representation of the molecule read
75  */
76  void getGraph(std::vector<String>& v, PairVector& e, const Molecule& mol);
77 
78  /* Floyd's Algorithm
79  * find shortest paths between all pairs of nodes
80  */
81  void makePathMatrix(const PairVector& e, SizeVector& sp, const Size e_size);
82 
83  /* compute concatenated strings [lambda(a)nlambda(b)] for every pair of nodes
84  */
85  void makePairs(const std::vector<String>& lambda_map, std::vector<String>& pairs, const std::vector<vector<Size> >& sp);
86 
87  /* compute lambda-map
88  */
89  String lambda(String lambda_d, const PairVector& e, const std::vector<String>& v, Size pos, Size d);
90 
91  /* construct final UCK as follows:
92  * chemical_formula-lexicographically ordered collection of strings pair(a,b)
93  */
94  void createFinalString(const std::vector<String>& pairs);
95 
100  float weight_;
101  };
102 
103 }//namespace
104 #endif // BALL_STRUCTURE_UCK_H