Add ending criteria for hierarchical; format graphs