Fixed bug with single network

formula contains degree_friends and degree_studymates which is not valid
for single network. Added an if statement to select correct formula. In
addition, added a if statement for detecting whether the formula is
"formula" or "Formula" object