Index: src/Graph/BondGraph.cpp
===================================================================
--- src/Graph/BondGraph.cpp	(revision 378fc6b3794e75dfde944b7b41cd15a3a54f23fd)
+++ src/Graph/BondGraph.cpp	(revision 326000af78937d00c935278d1a92caff13b936cd)
@@ -35,4 +35,5 @@
 #include "CodePatterns/MemDebug.hpp"
 
+#include <deque>
 #include <iostream>
 
@@ -49,4 +50,5 @@
 #include "Element/periodentafel.hpp"
 #include "Fragmentation/MatrixContainer.hpp"
+#include "Graph/DepthFirstSearchAnalysis.hpp"
 #include "LinearAlgebra/Vector.hpp"
 #include "World.hpp"
@@ -226,7 +228,13 @@
 
 /** Corrects the bond degree by one at most if necessary.
+ *
+ * We are constraint to bonds in \a egdes, if the candidate bond is in edges, we
+ * just don't increment its bond degree. We do not choose an alternative for this
+ * atom.
+ *
+ * \param edges only these edges can be updated
  * \return number of corrections done
  */
-int BondGraph::CorrectBondDegree(atom *_atom) const
+int BondGraph::CorrectBondDegree(atom *_atom, const std::set<bond::ptr>& edges) const
 {
   int NoBonds = 0;
@@ -260,6 +268,9 @@
     }
     if ((CandidateBond != NULL)) {
-      CandidateBond->setDegree(CandidateBond->getDegree()+1);
-      LOG(2, "Increased bond degree for bond " << *CandidateBond << ".");
+      if (edges.find(CandidateBond) != edges.end()) {
+        CandidateBond->setDegree(CandidateBond->getDegree()+1);
+        LOG(2, "Increased bond degree for bond " << *CandidateBond << ".");
+      } else
+        LOG(2, "Bond " << *CandidateBond << " is not in edges.");
     } else {
       ELOG(2, "Could not find correct degree for atom " << *_atom << ".");
@@ -268,5 +279,5 @@
   }
   return FalseBondDegree;
-};
+}
 
 /** Sets the weight of all connected bonds to one.
@@ -279,4 +290,32 @@
       ++BondRunner)
     (*BondRunner)->setDegree(1);
-};
-
+}
+
+std::set<bond::ptr> BondGraph::getBackEdges() const
+{
+  DepthFirstSearchAnalysis DFS;
+  DFS();
+
+  const std::deque<bond::ptr>& backedgestack = DFS.getBackEdgeStack();
+  std::set<bond::ptr> backedges(backedgestack.begin(), backedgestack.end());
+
+  return backedges;
+}
+
+std::set<bond::ptr> BondGraph::getTreeEdges() const
+{
+  const std::set<bond::ptr> backedges = getBackEdges();
+  std::set<bond::ptr> alledges;
+  const World& world = World::getInstance();
+  for(World::AtomConstIterator iter = world.getAtomIter();
+      iter != world.atomEnd(); ++iter) {
+    const BondList &ListOfBonds = (*iter)->getListOfBonds();
+    alledges.insert(ListOfBonds.begin(), ListOfBonds.end());
+  }
+  std::set<bond::ptr> treeedges;
+  std::set_difference(
+      alledges.begin(), alledges.end(),
+      backedges.begin(), backedges.end(),
+      std::inserter(treeedges, treeedges.begin()));
+  return treeedges;
+}
Index: src/Graph/BondGraph.hpp
===================================================================
--- src/Graph/BondGraph.hpp	(revision 378fc6b3794e75dfde944b7b41cd15a3a54f23fd)
+++ src/Graph/BondGraph.hpp	(revision 326000af78937d00c935278d1a92caff13b936cd)
@@ -473,5 +473,5 @@
             class iterator_type,
             class const_iterator_type>
-  void resetBondDegree(
+  void resetBondDegree (
       AtomSetMixin<container_type,iterator_type,const_iterator_type> &Set) const
   {
@@ -493,4 +493,7 @@
       AtomSetMixin<container_type,iterator_type,const_iterator_type> &Set) const
   {
+    const std::set<bond::ptr> backedges = getBackEdges();
+    const std::set<bond::ptr> treeedges = getTreeEdges();
+
     //LOG(1, "Correcting Bond degree of each bond ... ");
     int No = 0, OldNo = -1;
@@ -499,5 +502,8 @@
       No=0;
       for(iterator_type AtomRunner = Set.begin(); AtomRunner != Set.end(); ++AtomRunner) {
-        No+=CorrectBondDegree(*AtomRunner);
+        No+=CorrectBondDegree(*AtomRunner, backedges);
+      }
+      for(iterator_type AtomRunner = Set.begin(); AtomRunner != Set.end(); ++AtomRunner) {
+        No+=CorrectBondDegree(*AtomRunner, treeedges);
       }
     } while (OldNo != No);
@@ -512,5 +518,8 @@
   }
 
-  int CorrectBondDegree(atom *_atom) const;
+  std::set<bond::ptr> getBackEdges() const;
+  std::set<bond::ptr> getTreeEdges() const;
+
+  int CorrectBondDegree(atom *_atom, const std::set<bond::ptr>& skipedges) const;
 
   void resetBondDegree(atom *_atom) const;
