move the code for the function that constructs the csr graph for plan b out of the plan c solver loop