def find_ingredients_graph_leaves(product):
    """
    Recursive function to search the ingredients graph and find its leaves.

    Args:
        product (dict): Dict corresponding to a product or a compound ingredient.

    Returns:
        list: List containing the ingredients graph leaves.
    """

    if 'ingredients' in product:
        leaves = []
        for ingredient in product['ingredients']:
            subleaves = find_ingredients_graph_leaves(ingredient)

            if type(subleaves) == list:
                leaves += subleaves
            else:
                leaves.append(subleaves)

        return leaves

    else:
        return product