Added GraphFromCriteria function