layered graphs working