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