implemented graph functionality