Index: src/Fragmentation/Homology/HomologyGraph.cpp
===================================================================
--- src/Fragmentation/Homology/HomologyGraph.cpp	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
+++ src/Fragmentation/Homology/HomologyGraph.cpp	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
@@ -0,0 +1,86 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. All rights reserved.
+ * Please see the COPYING file or "Copyright notice" in builder.cpp for details.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>. 
+ */
+
+/*
+ * HomologyGraph.cpp
+ *
+ *  Created on: Sep 24, 2012
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "HomologyGraph.hpp"
+
+bool HomologyGraph::operator<(const HomologyGraph &graph) const
+{
+  if (nodes < graph.nodes) {
+    return true;
+  } else if (nodes > graph.nodes) {
+    return false;
+  } else {
+    if (edges < graph.edges)
+      return true;
+    else
+      return false;
+  }
+}
+
+bool HomologyGraph::operator>(const HomologyGraph &graph) const
+{
+  if (nodes > graph.nodes) {
+    return true;
+  } else if (nodes < graph.nodes) {
+    return false;
+  } else {
+    if (edges > graph.edges)
+      return true;
+    else
+      return false;
+  }
+}
+
+bool HomologyGraph::operator==(const HomologyGraph &graph) const
+{
+  if (nodes != graph.nodes) {
+    return false;
+  } else {
+    return (edges == graph.edges);
+  }
+}
+
+HomologyGraph& HomologyGraph::operator=(const HomologyGraph &graph)
+{
+  // self-assignment check
+  if (this != &graph) {
+    const_cast<nodes_t &>(nodes) = graph.nodes;
+    const_cast<edges_t &>(edges) = graph.edges;
+  }
+  return *this;
+}
Index: src/Fragmentation/Homology/HomologyGraph.hpp
===================================================================
--- src/Fragmentation/Homology/HomologyGraph.hpp	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
+++ src/Fragmentation/Homology/HomologyGraph.hpp	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
@@ -0,0 +1,89 @@
+/*
+ * HomologyGraph.hpp
+ *
+ *  Created on: Sep 24, 2012
+ *      Author: heber
+ */
+
+#ifndef HOMOLOGYGRAPH_HPP_
+#define HOMOLOGYGRAPH_HPP_
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <set>
+
+#include "Fragmentation/Homology/FragmentEdge.hpp"
+#include "Fragmentation/Homology/FragmentNode.hpp"
+
+/** This class contains the representation of a molecular fragment as a graph.
+ *
+ * Only, we do not store the full graph in here. We have to include symmetries
+ * such that two hydrogens may switch places. Eventually, we only look for the
+ * set of distances of a fragment. If two hydrogens switch places, then also in
+ * the set of distances some distances are interchanged but the whole fragment
+ * remains the same. Hence, we have to store the bond graph representation in
+ * such a way as to automatically include these symmetries.
+ *
+ * To this end, we use FragmentNode and FragmentEdge to store the vital
+ * information.
+ *
+ */
+class HomologyGraph
+{
+public:
+  //!> typedef for a set of nodes representing node information
+  typedef std::set<FragmentNode> nodes_t;
+  //!> typedef for a set of nodes representing edge information
+  typedef std::set<FragmentEdge> edges_t;
+public:
+  /** Default constructor for class HomologyGraph.
+   *
+   * This is required to allow placement in STL containers
+   *
+   */
+  HomologyGraph() {}
+
+  /** Constructor for class HomologyGraph.
+   *
+   * @param _nodes information on nodes of this graph
+   * @param _edges information on edges of this graph
+   */
+  HomologyGraph(const nodes_t &_nodes, const edges_t &_edges) :
+    nodes(_nodes),
+    edges(_edges)
+  {}
+
+  /** Destructor for class HomologyGraph.
+   *
+   */
+  ~HomologyGraph() {}
+
+  // comparators (allows sorting and hence quicker finding in STL containers)
+  bool operator<(const HomologyGraph &graph) const;
+  bool operator>(const HomologyGraph &graph) const;
+  bool operator==(const HomologyGraph &graph) const;
+  bool operator!=(const HomologyGraph &graph) const {
+    return (!(*this == graph));
+  }
+
+  /** Assignment operator for class HomologyGraph.
+   *
+   * This is required to allow placement in STL container as we need to
+   * const_cast override our const member variables.
+   *
+   */
+  HomologyGraph& operator=(const HomologyGraph &graph);
+
+private:
+  //!> information on the nodes of the graph
+  const nodes_t nodes;
+  //!> information on the edges of the graph
+  const edges_t edges;
+};
+
+
+#endif /* HOMOLOGYGRAPH_HPP_ */
Index: src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.cpp
===================================================================
--- src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.cpp	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
+++ src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.cpp	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
@@ -0,0 +1,148 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * HomologyGraphUnitTest.cpp
+ *
+ *  Created on: Sep 25, 2012
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+// include headers that implement a archive in simple text format
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include "Fragmentation/Homology/HomologyGraph.hpp"
+#include "Fragmentation/Graph.hpp"
+
+#include "HomologyGraphUnitTest.hpp"
+
+#include "CodePatterns/Assert.hpp"
+
+#include <boost/assign.hpp>
+
+using namespace boost::assign;
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( HomologyGraphTest );
+
+
+void HomologyGraphTest::setUp()
+{
+  // failing asserts should be thrown
+  ASSERT_DO(Assert::Throw);
+
+  // add nodes
+  nodes += FragmentNode(1,1),FragmentNode(1,4), FragmentNode(2,2), FragmentNode(2,4);
+  othernodes += FragmentNode(1,1),FragmentNode(1,4);
+
+  // add edges
+  edges += FragmentEdge(1,1),FragmentEdge(1,4), FragmentEdge(2,2), FragmentEdge(2,4);
+  otheredges += FragmentEdge(1,4),FragmentEdge(2,2);
+
+  // construct graph
+  graph = new HomologyGraph(nodes, edges);
+}
+
+
+void HomologyGraphTest::tearDown()
+{
+  delete graph;
+}
+
+/** UnitTest for whether homologies are correctly recognized
+ */
+void HomologyGraphTest::comparatorTest()
+{
+  // construct other graphs
+  HomologyGraph samegraph(nodes, edges);
+  HomologyGraph othergraph(nodes, otheredges);
+  HomologyGraph anothergraph(othernodes, edges);
+  HomologyGraph yetanothergraph(othernodes, otheredges);
+
+  // sort them (order is: anothergraph, yetanothergraph, graph/samegraph, othergraph)
+  CPPUNIT_ASSERT( !(*graph < samegraph) );
+  CPPUNIT_ASSERT( othergraph > *graph );
+  CPPUNIT_ASSERT( anothergraph < *graph );
+  CPPUNIT_ASSERT( yetanothergraph < *graph );
+  CPPUNIT_ASSERT( anothergraph < othergraph );
+  CPPUNIT_ASSERT( yetanothergraph < othergraph );
+  CPPUNIT_ASSERT( yetanothergraph > anothergraph );
+
+  CPPUNIT_ASSERT( !(*graph > samegraph) );
+  CPPUNIT_ASSERT( *graph < othergraph );
+  CPPUNIT_ASSERT( *graph > anothergraph );
+  CPPUNIT_ASSERT( *graph > yetanothergraph );
+  CPPUNIT_ASSERT( othergraph > anothergraph );
+  CPPUNIT_ASSERT( othergraph > yetanothergraph );
+  CPPUNIT_ASSERT( anothergraph < yetanothergraph );
+
+  // compare them
+  CPPUNIT_ASSERT( *graph == samegraph );
+  CPPUNIT_ASSERT( *graph != othergraph );
+  CPPUNIT_ASSERT( *graph != anothergraph );
+  CPPUNIT_ASSERT( *graph != yetanothergraph );
+  CPPUNIT_ASSERT( othergraph != anothergraph );
+  CPPUNIT_ASSERT( othergraph != yetanothergraph );
+  CPPUNIT_ASSERT( anothergraph != yetanothergraph );
+}
+
+/** UnitTest for operator=()
+ */
+void HomologyGraphTest::assigmentTest()
+{
+  HomologyGraph samegraph(nodes, edges);
+  HomologyGraph othergraph(othernodes, otheredges);
+
+  // check initial status
+  CPPUNIT_ASSERT( *graph == samegraph);
+  CPPUNIT_ASSERT( *graph != othergraph);
+
+  // now assign
+  samegraph = othergraph;
+  othergraph = *graph;
+
+  // and check again
+  CPPUNIT_ASSERT( *graph != samegraph);
+  CPPUNIT_ASSERT( *graph == othergraph);
+
+  // also self-assign
+  *graph = *graph;
+  CPPUNIT_ASSERT( *graph == *graph);
+}
Index: src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.hpp
===================================================================
--- src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.hpp	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
+++ src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.hpp	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
@@ -0,0 +1,47 @@
+/*
+ * HomologyGraphUnitTest.hpp
+ *
+ *  Created on: Sep 25, 2012
+ *      Author: heber
+ */
+
+#ifndef HOMOLOGYCONTAINERUNITTEST_HPP_
+#define HOMOLOGYCONTAINERUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "Fragmentation/Homology/FragmentEdge.hpp"
+#include "Fragmentation/Homology/FragmentNode.hpp"
+
+class HomologyGraph;
+
+/********************************************** Test classes **************************************/
+
+class HomologyGraphTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( HomologyGraphTest) ;
+    CPPUNIT_TEST ( comparatorTest );
+    CPPUNIT_TEST ( assigmentTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+      void comparatorTest();
+      void assigmentTest();
+
+private:
+      HomologyGraph *graph;
+      HomologyGraph::nodes_t nodes;
+      HomologyGraph::edges_t edges;
+      HomologyGraph::nodes_t othernodes;
+      HomologyGraph::edges_t otheredges;
+};
+
+#endif /* HOMOLOGYCONTAINERUNITTEST_HPP_ */
Index: src/Fragmentation/Homology/unittests/Makefile.am
===================================================================
--- src/Fragmentation/Homology/unittests/Makefile.am	(revision 8387e06f968d381b3fce254b7726ba0d11c5a748)
+++ src/Fragmentation/Homology/unittests/Makefile.am	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
@@ -5,15 +5,18 @@
 	../Fragmentation/Homology/unittests/FragmentEdgeUnitTest.cpp \
 	../Fragmentation/Homology/unittests/FragmentNodeUnitTest.cpp \
-	../Fragmentation/Homology/unittests/HomologyContainerUnitTest.cpp
+	../Fragmentation/Homology/unittests/HomologyContainerUnitTest.cpp \
+	../Fragmentation/Homology/unittests/HomologyGraphUnitTest.cpp
 
 FRAGMENTATIONHOMOLOGYTESTSHEADERS = \
 	../Fragmentation/Homology/unittests/FragmentEdgeUnitTest.hpp \
 	../Fragmentation/Homology/unittests/FragmentNodeUnitTest.hpp \
-	../Fragmentation/Homology/unittests/HomologyContainerUnitTest.hpp
+	../Fragmentation/Homology/unittests/HomologyContainerUnitTest.hpp \
+	../Fragmentation/Homology/unittests/HomologyGraphUnitTest.hpp
 
 FRAGMENTATIONHOMOLOGYTESTS = \
 	FragmentEdgeUnitTest \
 	FragmentNodeUnitTest \
-  HomologyContainerUnitTest
+  HomologyContainerUnitTest \
+  HomologyGraphUnitTest
 
 TESTS += $(FRAGMENTATIONHOMOLOGYTESTS)
@@ -45,4 +48,8 @@
 	$(BOOST_LIB)
 
+HomologyGraphUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	../Fragmentation/Homology/unittests/HomologyGraphUnitTest.cpp \
+	../Fragmentation/Homology/unittests/HomologyGraphUnitTest.hpp
+HomologyGraphUnitTest_LDADD = ${FRAGMENTATIONHOMOLOGYLIBS}
 
 #AUTOMAKE_OPTIONS = parallel-tests
Index: src/Fragmentation/Makefile.am
===================================================================
--- src/Fragmentation/Makefile.am	(revision 8387e06f968d381b3fce254b7726ba0d11c5a748)
+++ src/Fragmentation/Makefile.am	(revision 7b6b21f8725bdab8c2d666fc902d98a54d5ccaba)
@@ -8,4 +8,5 @@
 	Fragmentation/Homology/FragmentNode.cpp \
 	Fragmentation/Homology/HomologyContainer.cpp \
+	Fragmentation/Homology/HomologyGraph.cpp \
 	Fragmentation/AdaptivityMap.cpp \
 	Fragmentation/BondsPerShortestPath.cpp \
@@ -30,4 +31,5 @@
 	Fragmentation/Homology/FragmentNode.hpp \
 	Fragmentation/Homology/HomologyContainer.hpp \
+	Fragmentation/Homology/HomologyGraph.hpp \
 	Fragmentation/AdaptivityMap.hpp \
 	Fragmentation/AtomMask.hpp \
