Identifying link and loop polarity