1 | /** \file graph.cpp
|
---|
2 | *
|
---|
3 | * Function definitions for the class graph.
|
---|
4 | *
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef GRAPH_HPP_
|
---|
8 | #define GRAPH_HPP_
|
---|
9 |
|
---|
10 | /*********************************************** includes ***********************************/
|
---|
11 |
|
---|
12 | // include config.h
|
---|
13 | #ifdef HAVE_CONFIG_H
|
---|
14 | #include <config.h>
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | // STL headers
|
---|
18 | #include <deque>
|
---|
19 | #include <map>
|
---|
20 | #include <set>
|
---|
21 | #include <list>
|
---|
22 |
|
---|
23 | /****************************************** forward declarations *****************************/
|
---|
24 |
|
---|
25 | class atom;
|
---|
26 | class bond;
|
---|
27 | class config;
|
---|
28 | class molecule;
|
---|
29 |
|
---|
30 | class SubGraph;
|
---|
31 | class Node;
|
---|
32 | class Edge;
|
---|
33 |
|
---|
34 | /********************************************** definitions *********************************/
|
---|
35 |
|
---|
36 | typedef std::pair < int, class Node* > NodeMap;
|
---|
37 | typedef std::multimap < class Node*, class Edge* > EdgeMap;
|
---|
38 |
|
---|
39 | typedef std::deque<int> KeyStack;
|
---|
40 | typedef std::set<int> KeySet;
|
---|
41 | typedef std::pair<int, double> NumberValuePair;
|
---|
42 |
|
---|
43 | // needed for definition of Graph and GraphTestPair
|
---|
44 | struct KeyCompare
|
---|
45 | {
|
---|
46 | bool operator() (const KeySet SubgraphA, const KeySet SubgraphB) const;
|
---|
47 | };
|
---|
48 |
|
---|
49 | typedef std::map <KeySet, NumberValuePair, KeyCompare > Graph;
|
---|
50 | typedef std::pair <KeySet, NumberValuePair > GraphPair;
|
---|
51 | typedef std::pair<KeySet::iterator, bool> KeySetTestPair;
|
---|
52 | typedef std::pair<Graph::iterator, bool> GraphTestPair;
|
---|
53 |
|
---|
54 |
|
---|
55 | /******************************** Some small functions and/or structures **********************************/
|
---|
56 |
|
---|
57 | //bool operator < (KeySet SubgraphA, KeySet SubgraphB); //note: this declaration is important, otherwise normal < is used (producing wrong order)
|
---|
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
|
---|
60 |
|
---|
61 | /** Structure containing all values in power set combination generation.
|
---|
62 | */
|
---|
63 | struct UniqueFragments {
|
---|
64 | typedef std::list<bond*> BondsPerSP;
|
---|
65 | typedef std::vector< BondsPerSP > AllSPBonds;
|
---|
66 |
|
---|
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;
|
---|
77 | AllSPBonds BondsPerSPList;
|
---|
78 | int *BondsPerSPCount;
|
---|
79 | };
|
---|
80 |
|
---|
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 |
|
---|
116 |
|
---|
117 |
|
---|
118 | #endif /*GRAPH_HPP_*/
|
---|