making _allocate_to_subgraph() a member function allows not to pass $config as a parameter every time