graph isloop present impl