Turns out map<set<node*>> was much faster.