Loop prevention
BGP is a path vector routing protocol and does not contain a complete topology of the link state routing protocols.
The BGP attribute AS_PATH is a mandatory attribute and includes a complete listing of all ASNs that the prefix advertisement has traversed from its source AS. AS_PATH is used as a loop prevention mechanism in the BGP protocol. If a BGP router receives a prefix advertisement with its AS listed in the AS_PATH, it discards the prefix because the router thinks the advertisement forms a loop.