Text this: Building a network with assortative mixing starting from preference functions, with application to the spread of epidemics