UCK.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: UCK.h,v 1.4.18.2 2007/04/03 13:29:44 bertsch Exp $
00005 //
00006 
00007 #ifndef BALL_STRUCTURE_UCK_H
00008 #define BALL_STRUCTURE_UCK_H
00009 
00010 #ifndef BALL_DATATYPE_STRING_H
00011   #include <BALL/DATATYPE/string.h>
00012 #endif
00013 
00014 #include <vector>
00015 
00016 namespace BALL
00017 {
00018   class Molecule;
00019 
00024   class BALL_EXPORT UCK
00025   {
00026     public:
00027 
00030     typedef std::vector<std::pair<Size, Size> > PairVector;
00031     typedef std::vector<std::vector<Size> >     SizeVector;
00033 
00034     /* default constructor
00035     */
00036     UCK();
00037     
00038     /* constructor
00039     */
00040     UCK(const Molecule& mol, Size d=3);
00041     
00042     /* copy constructor
00043     */
00044     UCK(UCK& uck);
00045     
00046     /* destructor
00047     */
00048     virtual ~UCK();
00049     
00050     /* print Uck to std::out
00051     */
00052     void printUCK(std::ostream& outstr);
00053 
00054     Size getDepth();
00055 
00056     const String& getFormula() const;
00057 
00058     const String& getUCK() const;
00059 
00060     const String& getId() const;
00061 
00062     float getWeight();
00063     
00064     private:
00065     
00066     /* variation of UCK-Algorithm:
00067     * delete one occurance of the current label from the lambda string
00068     * this reduces the length of the constructed string
00069     */
00070     String eraseDoubleLabels(const Size d, String x, String label);
00071     
00072     /* computes the uck
00073     */
00074     void makeUCK(const Molecule& m);
00075     
00076     /* construct graph-representation of the molecule read
00077     */
00078     void getGraph(std::vector<String>& v, PairVector& e, const Molecule& mol);
00079     
00080     /* Floyd's Algorithm
00081     *  find shortest paths between all pairs of nodes
00082     */
00083     void makePathMatrix(const PairVector& e, SizeVector& sp, const Size e_size);
00084     
00085     /* compute concatenated strings [lambda(a)nlambda(b)] for every pair of nodes
00086     */
00087     void makePairs(const std::vector<String>& lambda_map, std::vector<String>& pairs, const std::vector<vector<Size> >& sp);
00088     
00089     /* compute lambda-map
00090     */
00091     String lambda(String lambda_d, const PairVector& e, const std::vector<String>& v, Size pos, Size d);
00092     
00093     /* construct final UCK as follows:
00094     *  chemical_formula-lexicographically ordered collection of strings pair(a,b)
00095     */
00096     void createFinalString(const std::vector<String>& pairs);
00097 
00098     Size depth_;
00099     String formula_; 
00100     String uck_str_; 
00101     String id_;
00102     float weight_;
00103   };
00104 
00105 }//namespace
00106 #endif // BALL_STRUCTURE_UCK_H