1 | /*
|
---|
2 | * HomologyGraph.hpp
|
---|
3 | *
|
---|
4 | * Created on: Sep 24, 2012
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef HOMOLOGYGRAPH_HPP_
|
---|
9 | #define HOMOLOGYGRAPH_HPP_
|
---|
10 |
|
---|
11 |
|
---|
12 | // include config.h
|
---|
13 | #ifdef HAVE_CONFIG_H
|
---|
14 | #include <config.h>
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | #include <set>
|
---|
18 |
|
---|
19 | #include "Fragmentation/Homology/FragmentEdge.hpp"
|
---|
20 | #include "Fragmentation/Homology/FragmentNode.hpp"
|
---|
21 |
|
---|
22 | /** This class contains the representation of a molecular fragment as a graph.
|
---|
23 | *
|
---|
24 | * Only, we do not store the full graph in here. We have to include symmetries
|
---|
25 | * such that two hydrogens may switch places. Eventually, we only look for the
|
---|
26 | * set of distances of a fragment. If two hydrogens switch places, then also in
|
---|
27 | * the set of distances some distances are interchanged but the whole fragment
|
---|
28 | * remains the same. Hence, we have to store the bond graph representation in
|
---|
29 | * such a way as to automatically include these symmetries.
|
---|
30 | *
|
---|
31 | * To this end, we use FragmentNode and FragmentEdge to store the vital
|
---|
32 | * information.
|
---|
33 | *
|
---|
34 | */
|
---|
35 | class HomologyGraph
|
---|
36 | {
|
---|
37 | public:
|
---|
38 | //!> typedef for a set of nodes representing node information
|
---|
39 | typedef std::set<FragmentNode> nodes_t;
|
---|
40 | //!> typedef for a set of nodes representing edge information
|
---|
41 | typedef std::set<FragmentEdge> edges_t;
|
---|
42 | public:
|
---|
43 | /** Default constructor for class HomologyGraph.
|
---|
44 | *
|
---|
45 | * This is required to allow placement in STL containers
|
---|
46 | *
|
---|
47 | */
|
---|
48 | HomologyGraph() {}
|
---|
49 |
|
---|
50 | /** Constructor for class HomologyGraph.
|
---|
51 | *
|
---|
52 | * @param _nodes information on nodes of this graph
|
---|
53 | * @param _edges information on edges of this graph
|
---|
54 | */
|
---|
55 | HomologyGraph(const nodes_t &_nodes, const edges_t &_edges) :
|
---|
56 | nodes(_nodes),
|
---|
57 | edges(_edges)
|
---|
58 | {}
|
---|
59 |
|
---|
60 | /** Destructor for class HomologyGraph.
|
---|
61 | *
|
---|
62 | */
|
---|
63 | ~HomologyGraph() {}
|
---|
64 |
|
---|
65 | // comparators (allows sorting and hence quicker finding in STL containers)
|
---|
66 | bool operator<(const HomologyGraph &graph) const;
|
---|
67 | bool operator>(const HomologyGraph &graph) const;
|
---|
68 | bool operator==(const HomologyGraph &graph) const;
|
---|
69 | bool operator!=(const HomologyGraph &graph) const {
|
---|
70 | return (!(*this == graph));
|
---|
71 | }
|
---|
72 |
|
---|
73 | /** Assignment operator for class HomologyGraph.
|
---|
74 | *
|
---|
75 | * This is required to allow placement in STL container as we need to
|
---|
76 | * const_cast override our const member variables.
|
---|
77 | *
|
---|
78 | */
|
---|
79 | HomologyGraph& operator=(const HomologyGraph &graph);
|
---|
80 |
|
---|
81 | private:
|
---|
82 | //!> information on the nodes of the graph
|
---|
83 | const nodes_t nodes;
|
---|
84 | //!> information on the edges of the graph
|
---|
85 | const edges_t edges;
|
---|
86 | };
|
---|
87 |
|
---|
88 |
|
---|
89 | #endif /* HOMOLOGYGRAPH_HPP_ */
|
---|