write graph classes