takes edges into account now