implementation of basic graph