graph: layout basic function