basic implementation of a graph