Index: src/Fragmentation/Homology/HomologyGraph.cpp
===================================================================
--- src/Fragmentation/Homology/HomologyGraph.cpp	(revision d058e636e53f3d9b6081470e70bece6d6ee784cc)
+++ src/Fragmentation/Homology/HomologyGraph.cpp	(revision 28e203e6456a3f5cc0834db4820e44de942f6625)
@@ -108,9 +108,9 @@
       nodeiter != graph.nodes.end();
       ++nodeiter)
-    ost << *nodeiter << " ";
+    ost << nodeiter->second << "x " << nodeiter->first << ", ";
   for (HomologyGraph::edges_t::const_iterator edgeiter = graph.edges.begin();
       edgeiter != graph.edges.end();
       ++edgeiter)
-    ost << *edgeiter << " ";
+    ost << edgeiter->second << "x " << edgeiter->first << ", ";
   return ost;
 }
Index: src/Fragmentation/Homology/HomologyGraph.hpp
===================================================================
--- src/Fragmentation/Homology/HomologyGraph.hpp	(revision d058e636e53f3d9b6081470e70bece6d6ee784cc)
+++ src/Fragmentation/Homology/HomologyGraph.hpp	(revision 28e203e6456a3f5cc0834db4820e44de942f6625)
@@ -16,7 +16,7 @@
 
 #include <boost/serialization/export.hpp>
-#include <boost/serialization/set.hpp>
+#include <boost/serialization/map.hpp>
 
-#include <set>
+#include <map>
 #include <iosfwd>
 
@@ -46,7 +46,7 @@
 public:
   //!> typedef for a set of nodes representing node information
-  typedef std::set<FragmentNode> nodes_t;
+  typedef std::map<FragmentNode, size_t> nodes_t;
   //!> typedef for a set of nodes representing edge information
-  typedef std::set<FragmentEdge> edges_t;
+  typedef std::map<FragmentEdge, size_t> edges_t;
 public:
   /** Default constructor for class HomologyGraph.
@@ -92,4 +92,32 @@
   }
 
+  /** Checks whether this graph contains a specific \a node.
+   *
+   * @param node node to look for
+   * @param count how often this node must occur
+   * @return true - graph contains this node at least once, false - else
+   */
+  bool hasNode(const FragmentNode &node, const size_t count = 1) const {
+    nodes_t::const_iterator iter = nodes.find(node);
+    if (iter == nodes.end())
+      return count == 0;
+    else
+      return (iter->second == count);
+  }
+
+  /** Checks whether this graph contains a specific \a edge.
+   *
+   * @param edge edge to look for
+   * @param count how often this edge must occur
+   * @return true - graph contains this edge at least once, false - else
+   */
+  bool hasEdge(const FragmentEdge &edge, const size_t count = 1) const {
+    edges_t::const_iterator iter = edges.find(edge);
+    if (iter == edges.end())
+      return count == 0;
+    else
+      return (iter->second == count);
+  }
+
   /** Assignment operator for class HomologyGraph.
    *
Index: src/Fragmentation/Homology/HomologyGraph_getFromKeyset.cpp
===================================================================
--- src/Fragmentation/Homology/HomologyGraph_getFromKeyset.cpp	(revision d058e636e53f3d9b6081470e70bece6d6ee784cc)
+++ src/Fragmentation/Homology/HomologyGraph_getFromKeyset.cpp	(revision 28e203e6456a3f5cc0834db4820e44de942f6625)
@@ -58,13 +58,23 @@
   for (typename std::set<T>::const_iterator iter = keyset.begin();
       iter != keyset.end(); ++iter) {
+//    LOG(2, "DEBUG: Current global id is " << *iter << ".");
     const atom *Walker = World::getInstance().getAtom(AtomById(*iter));
     if (Walker != NULL) {
+      size_t NoBonds = 0;
       const BondList& ListOfBonds = Walker->getListOfBonds();
-#ifndef NDEBUG
+      for (BondList::const_iterator bonditer = ListOfBonds.begin();
+          bonditer != ListOfBonds.end(); ++bonditer) {
+        const atom *OtherWalker = (*bonditer)->GetOtherAtom(Walker);
+        if (keyset.count(OtherWalker->getId()))
+          ++NoBonds;
+      }
+//      LOG(2, "DEBUG: Adding node " << Walker->getId() << " with element "
+//          << Walker->getElementNo() << " and " << NoBonds << " bonds.");
     std::pair<HomologyGraph::nodes_t::iterator,bool> inserter =
-#endif
-        nodes.insert( FragmentNode(Walker->getElementNo(), ListOfBonds.size()) );
+        nodes.insert( std::make_pair(FragmentNode(Walker->getElementNo(), NoBonds), (size_t)1) );
+    if (!inserter.second)
+      inserter.first->second += (size_t)1;
     } else {
-      ELOG(0, "Id " << *iter << " is not associated with any atom.");
+      ELOG(3, "Skipping id " << *iter << ", is not associated with any atom.");
     }
   }
@@ -78,4 +88,5 @@
   for (typename std::set<T>::const_iterator iter = keyset.begin();
       iter != keyset.end(); ++iter) {
+//    LOG(2, "DEBUG: Current global id is " << *iter << ".");
     const atom *Walker = World::getInstance().getAtom(AtomById(*iter));
     if (Walker != NULL) {
@@ -84,9 +95,15 @@
           bonditer != ListOfBonds.end(); ++bonditer) {
         const atom *OtherWalker = (*bonditer)->GetOtherAtom(Walker);
-        if (Walker->getId() < OtherWalker->getId())
-          edges.insert( FragmentEdge( Walker->getElementNo(), OtherWalker->getElementNo()) );
+//        LOG(2, "DEBUG: Neighbor is " << OtherWalker->getId() << ".");
+        if ((keyset.count(OtherWalker->getId())) && (Walker->getId() < OtherWalker->getId())) {
+//          LOG(1, "DEBUG: Adding edge " << Walker->getId() << " and " << OtherWalker->getId() << ".");
+          std::pair<HomologyGraph::edges_t::iterator,bool> inserter =
+              edges.insert( std::make_pair(FragmentEdge( Walker->getElementNo(), OtherWalker->getElementNo()), (size_t)1) );
+          if (!inserter.second)
+            inserter.first->second += (size_t)1;
+        }
       }
     } else {
-      ELOG(0, "Id " << *iter << " is not associated with any atom.");
+      ELOG(3, "Skipping id " << *iter << ", is not associated with any atom.");
     }
   }
Index: src/Fragmentation/Homology/unittests/HomologyContainerUnitTest.cpp
===================================================================
--- src/Fragmentation/Homology/unittests/HomologyContainerUnitTest.cpp	(revision d058e636e53f3d9b6081470e70bece6d6ee784cc)
+++ src/Fragmentation/Homology/unittests/HomologyContainerUnitTest.cpp	(revision 28e203e6456a3f5cc0834db4820e44de942f6625)
@@ -68,21 +68,21 @@
   // add nodes
   nodes +=
-      FragmentNode(1,1),
-      FragmentNode(1,4),
-      FragmentNode(2,2),
-      FragmentNode(2,4);
+      std::make_pair(FragmentNode(1,1),1),
+      std::make_pair(FragmentNode(1,4),1),
+      std::make_pair(FragmentNode(2,2),1),
+      std::make_pair(FragmentNode(2,4),1);
   othernodes +=
-      FragmentNode(1,1),
-      FragmentNode(1,4);
+      std::make_pair(FragmentNode(1,1),1),
+      std::make_pair(FragmentNode(1,4),1);
 
   // add edges
   edges +=
-      FragmentEdge(1,1),
-      FragmentEdge(1,4),
-      FragmentEdge(2,2),
-      FragmentEdge(2,4);
+      std::make_pair(FragmentEdge(1,1),1),
+      std::make_pair(FragmentEdge(1,4),1),
+      std::make_pair(FragmentEdge(2,2),1),
+      std::make_pair(FragmentEdge(2,4),1);
   otheredges +=
-      FragmentEdge(1,4),
-      FragmentEdge(2,2);
+      std::make_pair(FragmentEdge(1,4),1),
+      std::make_pair(FragmentEdge(2,2),1);
 
   // construct graphs
Index: src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.cpp
===================================================================
--- src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.cpp	(revision d058e636e53f3d9b6081470e70bece6d6ee784cc)
+++ src/Fragmentation/Homology/unittests/HomologyGraphUnitTest.cpp	(revision 28e203e6456a3f5cc0834db4820e44de942f6625)
@@ -71,10 +71,22 @@
 
   // add nodes
-  nodes += FragmentNode(1,1),FragmentNode(1,4), FragmentNode(2,2), FragmentNode(2,4);
-  othernodes += FragmentNode(1,1),FragmentNode(1,4);
+  nodes +=
+      std::make_pair(FragmentNode(1,1),1),
+      std::make_pair(FragmentNode(1,4),1),
+      std::make_pair(FragmentNode(2,2),1),
+      std::make_pair(FragmentNode(2,4),1);
+  othernodes +=
+      std::make_pair(FragmentNode(1,1),1),
+      std::make_pair(FragmentNode(1,4),1);
 
   // add edges
-  edges += FragmentEdge(1,1),FragmentEdge(1,4), FragmentEdge(2,2), FragmentEdge(2,4);
-  otheredges += FragmentEdge(1,4),FragmentEdge(2,2);
+  edges +=
+      std::make_pair(FragmentEdge(1,1),1),
+      std::make_pair(FragmentEdge(1,4),1),
+      std::make_pair(FragmentEdge(2,2),1),
+      std::make_pair(FragmentEdge(2,4),1);
+  otheredges +=
+      std::make_pair(FragmentEdge(1,4),1),
+      std::make_pair(FragmentEdge(2,2),1);
 
   // construct graph
