| [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; | 
|---|
| [a03d25] | 33 | class UniqueFragments; | 
|---|
| [5621c3] | 34 |  | 
|---|
| [f66195] | 35 | /********************************************** definitions *********************************/ | 
|---|
| [5621c3] | 36 |  | 
|---|
| [c37386] | 37 | typedef std::pair < int, class Node* > NodeMap; | 
|---|
|  | 38 | typedef std::multimap < class Node*, class Edge* > EdgeMap; | 
|---|
| [5621c3] | 39 |  | 
|---|
| [c37386] | 40 | typedef std::deque<int> KeyStack; | 
|---|
|  | 41 | typedef std::set<int> KeySet; | 
|---|
|  | 42 | typedef std::pair<int, double> NumberValuePair; | 
|---|
| [5621c3] | 43 |  | 
|---|
| [c37386] | 44 | // needed for definition of Graph and GraphTestPair | 
|---|
| [f66195] | 45 | struct KeyCompare | 
|---|
| [5621c3] | 46 | { | 
|---|
| [f66195] | 47 | bool operator() (const KeySet SubgraphA, const KeySet SubgraphB) const; | 
|---|
| [5621c3] | 48 | }; | 
|---|
|  | 49 |  | 
|---|
| [c37386] | 50 | typedef std::map <KeySet, NumberValuePair, KeyCompare > Graph; | 
|---|
|  | 51 | typedef std::pair <KeySet, NumberValuePair > GraphPair; | 
|---|
|  | 52 | typedef std::pair<KeySet::iterator, bool> KeySetTestPair; | 
|---|
| [d4103c8] | 53 | typedef std::pair<Graph::iterator, bool> GraphTestPair; | 
|---|
| [c37386] | 54 |  | 
|---|
|  | 55 |  | 
|---|
|  | 56 | /******************************** Some small functions and/or structures **********************************/ | 
|---|
|  | 57 |  | 
|---|
| [f66195] | 58 | //bool operator < (KeySet SubgraphA, KeySet SubgraphB);   //note: this declaration is important, otherwise normal < is used (producing wrong order) | 
|---|
| [e138de] | 59 | void InsertGraphIntoGraph(Graph &graph1, Graph &graph2, int *counter);  // Insert all KeySet's in a Graph into another Graph | 
|---|
| [f66195] | 60 |  | 
|---|
| [5621c3] | 61 |  | 
|---|
| [f66195] | 62 | /********************************************** declarations *******************************/ | 
|---|
|  | 63 |  | 
|---|
|  | 64 | ///** Graph class containing the graphs behind molecules. | 
|---|
|  | 65 | // */ | 
|---|
|  | 66 | //class Graph | 
|---|
|  | 67 | //{ | 
|---|
|  | 68 | //      NodeMap ListOfNodes;            //!< tree-list of all nodes in this graph | 
|---|
|  | 69 | //      EdgeMap ListOfEdges;            //!< tree-multi-list of all nodes, referenced to node id | 
|---|
|  | 70 | //}; | 
|---|
|  | 71 | // | 
|---|
|  | 72 | ///** Class describing subgraphs of the Class \a Graph. | 
|---|
|  | 73 | // * SubGraph has its own node and edge lists, however also a pointer to its father graph | 
|---|
|  | 74 | // * and hence access to its list as well. | 
|---|
|  | 75 | // */ | 
|---|
|  | 76 | //class SubGraph : class Graph | 
|---|
|  | 77 | //{ | 
|---|
|  | 78 | //      class Graph *FatherGraph;               //!< Graph whose subgraph we are | 
|---|
|  | 79 | //}; | 
|---|
|  | 80 | // | 
|---|
|  | 81 | ///** Class containing the nodes of a graph. | 
|---|
|  | 82 | // */ | 
|---|
|  | 83 | //class Node | 
|---|
|  | 84 | //{ | 
|---|
|  | 85 | //      int     id;                             //!< individual id of the node | 
|---|
|  | 86 | //      char *Name;             //!< Name of the node for pretty printing | 
|---|
|  | 87 | //}; | 
|---|
|  | 88 | // | 
|---|
|  | 89 | ///** Class containing egdes in a Graph strructure. | 
|---|
|  | 90 | // */ | 
|---|
|  | 91 | //class Edge | 
|---|
|  | 92 | //{ | 
|---|
|  | 93 | //      class Node *leftnode;           //!< pointer to first node | 
|---|
|  | 94 | //      class Node *atomnode;           //!< pointer to second node | 
|---|
|  | 95 | //}; | 
|---|
|  | 96 |  | 
|---|
| [5621c3] | 97 |  | 
|---|
|  | 98 |  | 
|---|
|  | 99 | #endif /*GRAPH_HPP_*/ | 
|---|