Index: src/Fragmentation/BondsPerShortestPath.hpp
===================================================================
--- src/Fragmentation/BondsPerShortestPath.hpp	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/BondsPerShortestPath.hpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -17,8 +17,7 @@
 #include <vector>
 
-#include "graph.hpp"
-
 class atom;
 class bond;
+class KeySet;
 
 class BondsPerShortestPath
Index: src/Fragmentation/Fragmentation.cpp
===================================================================
--- src/Fragmentation/Fragmentation.cpp	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/Fragmentation.cpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -29,4 +29,5 @@
 #include "Element/periodentafel.hpp"
 #include "Fragmentation/fragmentation_helpers.hpp"
+#include "Fragmentation/Graph.hpp"
 #include "Fragmentation/KeySet.hpp"
 #include "Fragmentation/PowerSetGenerator.hpp"
Index: src/Fragmentation/Fragmentation.hpp
===================================================================
--- src/Fragmentation/Fragmentation.hpp	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/Fragmentation.hpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -16,8 +16,10 @@
 #include <string>
 
-#include "graph.hpp"
 #include "Graph/DepthFirstSearchAnalysis.hpp"
 
+#include "graph.hpp"
+
 class atom;
+class Graph;
 class KeySet;
 class molecule;
Index: src/Fragmentation/Graph.cpp
===================================================================
--- src/Fragmentation/Graph.cpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
+++ src/Fragmentation/Graph.cpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -0,0 +1,57 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * Graph.cpp
+ *
+ *  Created on: Oct 20, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "Graph.hpp"
+
+#include "CodePatterns/Log.hpp"
+
+/** Constructor for class Graph.
+ *
+ */
+Graph::Graph()
+{}
+
+/** Destructor for class Graph.
+ *
+ */
+Graph::~Graph()
+{}
+
+/** Inserts each KeySet in \a graph into \a this.
+ * \param graph1 graph whose KeySet are inserted into \this graph
+ * \param *counter keyset counter that gets increased
+ */
+void Graph::InsertGraph(Graph &graph, int *counter)
+{
+  GraphTestPair testGraphInsert;
+
+  for(Graph::iterator runner = graph.begin(); runner != graph.end(); runner++) {
+    testGraphInsert = insert(GraphPair ((*runner).first,pair<int,double>((*counter)++,((*runner).second).second)));  // store fragment number and current factor
+    if (testGraphInsert.second) {
+      LOG(2, "INFO: KeySet " << (*counter)-1 << " successfully inserted.");
+    } else {
+      LOG(2, "INFO: KeySet " << (*counter)-1 << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first);
+      ((*(testGraphInsert.first)).second).second += (*runner).second.second;
+      LOG(2, "INFO: New factor is " << (*(testGraphInsert.first)).second.second << ".");
+    }
+  }
+};
+
Index: src/Fragmentation/Graph.hpp
===================================================================
--- src/Fragmentation/Graph.hpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
+++ src/Fragmentation/Graph.hpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -0,0 +1,34 @@
+/*
+ * Graph.hpp
+ *
+ *  Created on: Oct 20, 2011
+ *      Author: heber
+ */
+
+#ifndef FRAGMENTATION_GRAPH_HPP_
+#define FRAGMENTATION_GRAPH_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <map>
+
+#include "Fragmentation/KeySet.hpp"
+
+typedef std::pair<int, double> NumberValuePair;
+typedef std::pair<KeySet, NumberValuePair> GraphPair;
+
+class Graph : public std::map <KeySet, NumberValuePair >
+{
+public:
+  Graph();
+  ~Graph();
+
+  void InsertGraph(Graph &graph, int *counter);
+};
+
+typedef std::pair<Graph::iterator, bool> GraphTestPair;
+
+#endif /* FRAGMENTATION_GRAPH_HPP_ */
Index: src/Fragmentation/Makefile.am
===================================================================
--- src/Fragmentation/Makefile.am	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/Makefile.am	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -8,4 +8,5 @@
 	Fragmentation/Fragmentation.cpp \
 	Fragmentation/fragmentation_helpers.cpp \
+	Fragmentation/Graph.cpp \
 	Fragmentation/helpers.cpp \
 	Fragmentation/HessianMatrix.cpp \
@@ -23,4 +24,6 @@
 	Fragmentation/Fragmentation.hpp \
 	Fragmentation/fragmentation_helpers.hpp \
+	Fragmentation/Graph.hpp \
+	Fragmentation/helpers.cpp \
 	Fragmentation/helpers.hpp \
 	Fragmentation/HessianMatrix.hpp \
Index: src/Fragmentation/PowerSetGenerator.hpp
===================================================================
--- src/Fragmentation/PowerSetGenerator.hpp	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/PowerSetGenerator.hpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -18,8 +18,7 @@
 
 #include "Fragmentation/BondsPerShortestPath.hpp"
-#include "graph.hpp"
 
 class bond;
-class UniqueFragment;
+class UniqueFragments;
 
 class PowerSetGenerator
Index: src/Fragmentation/UniqueFragments.cpp
===================================================================
--- src/Fragmentation/UniqueFragments.cpp	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/UniqueFragments.cpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -27,4 +27,5 @@
 #include "Bond/bond.hpp"
 #include "Element/element.hpp"
+#include "Fragmentation/Graph.hpp"
 #include "Fragmentation/KeySet.hpp"
 #include "graph.hpp"
Index: src/Fragmentation/UniqueFragments.hpp
===================================================================
--- src/Fragmentation/UniqueFragments.hpp	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/UniqueFragments.hpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -17,9 +17,9 @@
 #include <vector>
 
-#include "graph.hpp"
-
 class atom;
 class bond;
 class config;
+class Graph;
+class KeySet;
 
 /** Structure containing all values in power set combination generation.
Index: src/Fragmentation/fragmentation_helpers.cpp
===================================================================
--- src/Fragmentation/fragmentation_helpers.cpp	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/fragmentation_helpers.cpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -29,5 +29,7 @@
 #include "Bond/bond.hpp"
 #include "Element/element.hpp"
+#include "Fragmentation/Graph.hpp"
 #include "Fragmentation/KeySet.hpp"
+#include "graph.hpp"
 #include "Helpers/defs.hpp"
 #include "Helpers/helpers.hpp"
@@ -457,5 +459,5 @@
     for(int i=0;i<NumLevels;i++) {
       if (FragmentLowerOrdersList[RootNr][i] != NULL) {
-        InsertGraphIntoGraph(*FragmentList, (*FragmentLowerOrdersList[RootNr][i]), &counter);
+        (*FragmentList).InsertGraph((*FragmentLowerOrdersList[RootNr][i]), &counter);
       }
     }
Index: src/Fragmentation/fragmentation_helpers.hpp
===================================================================
--- src/Fragmentation/fragmentation_helpers.hpp	(revision f0674ad457e26229a9fc919b6f3659591649bf06)
+++ src/Fragmentation/fragmentation_helpers.hpp	(revision dadc744c2f6ef8c2075a7e5a791c33b711bd6e20)
@@ -22,4 +22,6 @@
 
 class bond;
+class Graph;
+class KeySet;
 class molecule;
 
