Made compact graph representation. Need to write tests