3 ms·
The advantage of using the library is that you would be able to answer connectivity queries and traverse the connected components of the graph efficiently. EDI
by 33a 12y ago
The advantage of using the library is that you would be able to answer connectivity queries and traverse the connected components of the graph efficiently.
EDIT: If you want an example application, suppose you have a physics simulation with a bunch of connected rigid bodies. You would like to be able to quickly test if two boxes are connected by links to the same body or to detect if after breaking a joint the resulting body becomes disconnected into two different pieces. Using a data structure like this would be faster than brute force searching over the graph of all bodies every time you change a link by connecting/disconnecting two bodies.