fixed several memory leaks (yay valgrind), still having issues with linked_graph free