One or Two-pass visitor ?
When you need to first traverse all elements before working on their associations, you need a two-pass visitor :
a first visitor, where visit_<uml_element> methods are redefined, inheriting from NODE_VISITOR
a second one, where visit_association is redefined, inheriting from ASSOCIATION_VISITOR
? CDIF_GENERATOR is an example of such a 2-pass visitor