def importall(recipes_=None): """ Call to import everything """ global graph, degree, recipes, top graph = defaultdict(lambda: defaultdict(float)) degree = defaultdict(float) recipes = recipes_ if recipes_ else utils.getrecipes() top = utils.gettop() for recipe_id in tqdm.tqdm(recipes): ingredients = recipes[recipe_id] for a in ingredients: for b in ingredients: if a != b and a in top and b in top: graph[a][b] += 1.0 for a in graph: for b in graph[a]: degree[a] += graph[a][b]