diff --git a/verarbeitung/Processing.py b/verarbeitung/Processing.py
index ac85f522ac884d5e48fedef2f42f256bba610c79..753bbe94baf025b9c7a6138016486de0fe5afdc8 100644
--- a/verarbeitung/Processing.py
+++ b/verarbeitung/Processing.py
@@ -63,7 +63,7 @@ def create_graph_structure_citations(pub, search_height, search_height_max):
                 edges.append([citation.doi_url,pub.doi_url])
 
         # adds only edge if citation already exists         
-        else:
+        elif [citation.doi_url,pub.doi_url] not in edges:
             edges.append([citation.doi_url,pub.doi_url])   
 
 
@@ -85,7 +85,7 @@ def create_graph_structure_references(pub, search_depth, search_depth_max):
                 edges.append([pub.doi_url,reference.doi_url])
 
         # adds only edge if citation already exists           
-        else:
+        elif [pub.doi_url,reference.doi_url] not in edges:
             edges.append([pub.doi_url,reference.doi_url])      
     
 
@@ -182,13 +182,20 @@ def process_main(doi_input_list, search_height, search_depth, test_var = False):
     output_to_json(nodes,edges)
 
     # only for internal testing
-    return(nodes,edges)
+    doi_nodes = []
+    for node in nodes:
+        doi_nodes.append(node.doi_url)
+    return(doi_nodes,edges)
+
+
+
+    
 
 def print_graph(nodes, edges):
     print("Knoten:\n")
     for node in nodes:
         print(node.title, "\n")
-    print("\n Kanten:\n")
+    print("\nKanten:\n")
     for edge in edges:
         print(edge,"\n")
    
@@ -201,6 +208,8 @@ def test_cycle():
 
     nodes,edges = process_main(arr,1,1,True)
 
+    print(nodes, edges)
+
     print_graph(nodes, edges)
     
 # program test, because there is no connection to the input yet.
@@ -222,5 +231,8 @@ def test_print():
     print_graph(nodes, edges)
 
 #test_print()
-test_cycle()
+#test_cycle()
+print(process_main(['doiz1'],1,1,True))
+print(process_main(['doi1'],0,0,True))
+
         
\ No newline at end of file
diff --git a/verarbeitung/Processing_unittest.py b/verarbeitung/Processing_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..b9f810467cb8b8cb2dcb8fa4dc6cd3af781a1999
--- /dev/null
+++ b/verarbeitung/Processing_unittest.py
@@ -0,0 +1,23 @@
+import unittest
+from Processing import process_main
+
+class ProcessingTest(unittest.TestCase):
+    def testCycle(self):
+        self.assertEqual(process_main(['doiz1'],1,1,True), (['doiz1', 'doiz2'], [['doiz2', 'doiz1'], ['doiz1', 'doiz2']]))
+        self.assertEqual(process_main(['doiz1'],2,2,True), (['doiz1', 'doiz2'], [['doiz2', 'doiz1'], ['doiz1', 'doiz2']]))
+
+    #def testBigCycle(self):
+
+    #def testEmptyHeight(self):
+
+    #def testEmptyDepth(self):
+
+    def testEmptyDepthHeight(self):
+        self.assertEqual(process_main(['doi1'],0,0,True), (['doi1'], []))
+        self.assertEqual(process_main(['doi1', 'doi2'],0,0,True), (['doi1','doi2'], [['doi1', 'doi2']]))
+        self.assertEqual(process_main(['doi1', 'doi2', 'doi3'],0,0,True), (['doi1','doi2', 'doi3'], [['doi3', 'doi1'], ['doi1', 'doi2']]))
+
+    #def testInnerEdges(self):
+
+if __name__ == "__main__":
+    unittest.main()
\ No newline at end of file
diff --git a/verarbeitung/__pycache__/Processing.cpython-36.pyc b/verarbeitung/__pycache__/Processing.cpython-36.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..eb6d8a0418a1340b746f2f664997515622356d8a
Binary files /dev/null and b/verarbeitung/__pycache__/Processing.cpython-36.pyc differ
diff --git a/verarbeitung/__pycache__/input_test.cpython-36.pyc b/verarbeitung/__pycache__/input_test.cpython-36.pyc
index 9dd609c5b2fe3d7530f4120f8993c04d58f4600c..85878d6d127d9d2bd5efe9130672d982bb70c5fa 100644
Binary files a/verarbeitung/__pycache__/input_test.cpython-36.pyc and b/verarbeitung/__pycache__/input_test.cpython-36.pyc differ
diff --git a/verarbeitung/__pycache__/unittest.cpython-36.pyc b/verarbeitung/__pycache__/unittest.cpython-36.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..245eb7f9be9221daa930d9fa83c77368ba463af7
Binary files /dev/null and b/verarbeitung/__pycache__/unittest.cpython-36.pyc differ
diff --git a/verarbeitung/json_text.json b/verarbeitung/json_text.json
index 8f648bf42654aefc13dd47dcecee507306184420..5b81672e2236baf25949729c3c32b56f7d08edc8 100644
--- a/verarbeitung/json_text.json
+++ b/verarbeitung/json_text.json
@@ -1 +1 @@
-{"nodes": [{"name": "titlez1", "author": ["contributorz1.1", "contributorz1.2"], "year": "datez1", "journal": "journalz1", "doi": "doiz1", "group": "input"}, {"name": "titlez2", "author": ["contributorz2.1", "contributorz2.2"], "year": "datez2", "journal": "journalz2", "doi": "doiz2", "group": "depth"}], "links": [{"source": "doiz1", "target": "doiz2"}]}
\ No newline at end of file
+{"nodes": [{"name": "title1", "author": ["contributor1"], "year": "date1", "journal": "journal1", "doi": "doi1", "group": "input"}, {"name": "title2", "author": ["contributor2"], "year": "date2", "journal": "journal2", "doi": "doi2", "group": "input"}, {"name": "title3", "author": ["contributor3"], "year": "date3", "journal": "journal3", "doi": "doi3", "group": "input"}], "links": [{"source": "doi3", "target": "doi1"}, {"source": "doi1", "target": "doi2"}]}
\ No newline at end of file