|
|
Graphs have been optimized so that the member functions insert, remove, and contains perform in O(1) time. The remaining member functions, which iterate over Graph data, perform in O(n) time, where n is the number of objects in the iteration. Iteration is slower than iteration over a list or an array, but by a constant factor.
Extensive performance tests have been performed on the Graph Algorithms package. Most results are O(v + e), where v represents the number of Vertices and e represents the number of Edges in the Graph. The cycle results are worst case O(v+e) but in practice are much better than this, approximating constant time.