| [5621c3] | 1 | /** \file graph.cpp | 
|---|
|  | 2 | * | 
|---|
|  | 3 | * Function definitions for the class graph. | 
|---|
|  | 4 | * | 
|---|
|  | 5 | */ | 
|---|
|  | 6 |  | 
|---|
|  | 7 | #ifndef GRAPH_HPP_ | 
|---|
|  | 8 | #define GRAPH_HPP_ | 
|---|
|  | 9 |  | 
|---|
| [f66195] | 10 | /*********************************************** includes ***********************************/ | 
|---|
|  | 11 |  | 
|---|
| [5621c3] | 12 | // include config.h | 
|---|
|  | 13 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 14 | #include <config.h> | 
|---|
|  | 15 | #endif | 
|---|
|  | 16 |  | 
|---|
|  | 17 | // STL headers | 
|---|
| [f66195] | 18 | #include <deque> | 
|---|
| [5621c3] | 19 | #include <map> | 
|---|
| [f66195] | 20 | #include <set> | 
|---|
| [03c77c] | 21 | #include <list> | 
|---|
| [f66195] | 22 |  | 
|---|
|  | 23 | /****************************************** forward declarations *****************************/ | 
|---|
| [5621c3] | 24 |  | 
|---|
| [f66195] | 25 | class atom; | 
|---|
|  | 26 | class bond; | 
|---|
|  | 27 | class config; | 
|---|
|  | 28 | class molecule; | 
|---|
| [5621c3] | 29 |  | 
|---|
|  | 30 | class SubGraph; | 
|---|
|  | 31 | class Node; | 
|---|
|  | 32 | class Edge; | 
|---|
|  | 33 |  | 
|---|
| [f66195] | 34 | /********************************************** definitions *********************************/ | 
|---|
| [5621c3] | 35 |  | 
|---|
| [c37386] | 36 | typedef std::pair < int, class Node* > NodeMap; | 
|---|
|  | 37 | typedef std::multimap < class Node*, class Edge* > EdgeMap; | 
|---|
| [5621c3] | 38 |  | 
|---|
| [c37386] | 39 | typedef std::deque<int> KeyStack; | 
|---|
|  | 40 | typedef std::set<int> KeySet; | 
|---|
|  | 41 | typedef std::pair<int, double> NumberValuePair; | 
|---|
| [5621c3] | 42 |  | 
|---|
| [c37386] | 43 | // needed for definition of Graph and GraphTestPair | 
|---|
| [f66195] | 44 | struct KeyCompare | 
|---|
| [5621c3] | 45 | { | 
|---|
| [f66195] | 46 | bool operator() (const KeySet SubgraphA, const KeySet SubgraphB) const; | 
|---|
| [5621c3] | 47 | }; | 
|---|
|  | 48 |  | 
|---|
| [c37386] | 49 | typedef std::map <KeySet, NumberValuePair, KeyCompare > Graph; | 
|---|
|  | 50 | typedef std::pair <KeySet, NumberValuePair > GraphPair; | 
|---|
|  | 51 | typedef std::pair<KeySet::iterator, bool> KeySetTestPair; | 
|---|
| [d4103c8] | 52 | typedef std::pair<Graph::iterator, bool> GraphTestPair; | 
|---|
| [c37386] | 53 |  | 
|---|
|  | 54 |  | 
|---|
|  | 55 | /******************************** Some small functions and/or structures **********************************/ | 
|---|
|  | 56 |  | 
|---|
| [f66195] | 57 | //bool operator < (KeySet SubgraphA, KeySet SubgraphB);   //note: this declaration is important, otherwise normal < is used (producing wrong order) | 
|---|
| [e138de] | 58 | void InsertFragmentIntoGraph(struct UniqueFragments *Fragment); // Insert a KeySet into a Graph | 
|---|
|  | 59 | void InsertGraphIntoGraph(Graph &graph1, Graph &graph2, int *counter);  // Insert all KeySet's in a Graph into another Graph | 
|---|
| [f66195] | 60 |  | 
|---|
|  | 61 | /** Structure containing all values in power set combination generation. | 
|---|
| [5621c3] | 62 | */ | 
|---|
| [f66195] | 63 | struct UniqueFragments { | 
|---|
| [03c77c] | 64 | typedef std::list<bond*> BondsPerSP; | 
|---|
|  | 65 | typedef std::vector< BondsPerSP > AllSPBonds; | 
|---|
|  | 66 |  | 
|---|
| [f66195] | 67 | config *configuration; | 
|---|
|  | 68 | atom *Root; | 
|---|
|  | 69 | Graph *Leaflet; | 
|---|
|  | 70 | KeySet *FragmentSet; | 
|---|
|  | 71 | int ANOVAOrder; | 
|---|
|  | 72 | int FragmentCounter; | 
|---|
|  | 73 | int CurrentIndex; | 
|---|
|  | 74 | double TEFactor; | 
|---|
|  | 75 | int *ShortestPathList; | 
|---|
|  | 76 | bool **UsedList; | 
|---|
| [03c77c] | 77 | AllSPBonds BondsPerSPList; | 
|---|
| [f66195] | 78 | int *BondsPerSPCount; | 
|---|
| [5621c3] | 79 | }; | 
|---|
|  | 80 |  | 
|---|
| [f66195] | 81 | /********************************************** declarations *******************************/ | 
|---|
|  | 82 |  | 
|---|
|  | 83 | ///** Graph class containing the graphs behind molecules. | 
|---|
|  | 84 | // */ | 
|---|
|  | 85 | //class Graph | 
|---|
|  | 86 | //{ | 
|---|
|  | 87 | //      NodeMap ListOfNodes;            //!< tree-list of all nodes in this graph | 
|---|
|  | 88 | //      EdgeMap ListOfEdges;            //!< tree-multi-list of all nodes, referenced to node id | 
|---|
|  | 89 | //}; | 
|---|
|  | 90 | // | 
|---|
|  | 91 | ///** Class describing subgraphs of the Class \a Graph. | 
|---|
|  | 92 | // * SubGraph has its own node and edge lists, however also a pointer to its father graph | 
|---|
|  | 93 | // * and hence access to its list as well. | 
|---|
|  | 94 | // */ | 
|---|
|  | 95 | //class SubGraph : class Graph | 
|---|
|  | 96 | //{ | 
|---|
|  | 97 | //      class Graph *FatherGraph;               //!< Graph whose subgraph we are | 
|---|
|  | 98 | //}; | 
|---|
|  | 99 | // | 
|---|
|  | 100 | ///** Class containing the nodes of a graph. | 
|---|
|  | 101 | // */ | 
|---|
|  | 102 | //class Node | 
|---|
|  | 103 | //{ | 
|---|
|  | 104 | //      int     id;                             //!< individual id of the node | 
|---|
|  | 105 | //      char *Name;             //!< Name of the node for pretty printing | 
|---|
|  | 106 | //}; | 
|---|
|  | 107 | // | 
|---|
|  | 108 | ///** Class containing egdes in a Graph strructure. | 
|---|
|  | 109 | // */ | 
|---|
|  | 110 | //class Edge | 
|---|
|  | 111 | //{ | 
|---|
|  | 112 | //      class Node *leftnode;           //!< pointer to first node | 
|---|
|  | 113 | //      class Node *atomnode;           //!< pointer to second node | 
|---|
|  | 114 | //}; | 
|---|
|  | 115 |  | 
|---|
| [5621c3] | 116 |  | 
|---|
|  | 117 |  | 
|---|
|  | 118 | #endif /*GRAPH_HPP_*/ | 
|---|