In this post, we use the Flavor Network to analyze ingredient patterns across 15 different cuisines (Mexican, Italian, French, Spanish, Greek, German, British, Turkish, Indian, Ethiopian, Egyptian, Kenyan, Chinese, Thai, and Brazilian). Using a small sample of recipes and several network-based metrics, we compare ingredient combinations across these cuisines. This illustrates how graph theory can provide useful insights into food and cooking.

The Flavor Network

The Flavor Network is a graph in which the vertices represent food ingredients and the edges connect ingredients that share flavor compounds. The edge weights represent the number of flavor compounds shared between each pair of ingredients.
In[]:=
The network is derived from the flavor profile graph [1,2], a bipartite graph that contains 1,530 food ingredients, their associated flavor compounds, and 36,781 ingredient–compound relationships. Each ingredient can also be classified into a food category, and the flavor compounds can be identified using their CAS numbers.
Out[]=
The full Flavor Network is highly dense and therefore difficult to visualize and analyze directly. One way to address this is to use the network backbone, which retains statistically significant connections and provides a sparser representation of the most relevant flavor relationships, such as the one extracted by Ling Cheng [2].
Out[]=
Another approach, which we explore in this post, is to construct a subgraph containing only the ingredients found in our selected recipes. This allows us to focus on specific cuisines while preserving the flavor relationships among their ingredients. We can then use this manageable representation to investigate ingredient relationships, combinations, and patterns across cuisines.

Recipe Extraction

AI Recipe Extraction

For the recipe extraction, we used Claude Max and its agent capabilities to perform the web-based recipe extraction using the following prompt.
I want you to build a dataset of 10 culturally representative recipes from each cuisine. Use my ingredient list as the reference vocabulary. Do not introduce new ingredient names into the final results unless they are synonyms or variants of an ingredient already present in my list.
So, search the internet for 10 representative and well-known recipes from each of the following culinary traditions:
◼
  • Mexican
  • ◼
  • Italian
  • ◼
  • French
  • ◼
  • Spanish
  • ◼
  • Greek
  • ◼
  • German
  • ◼
  • British
  • ◼
  • Turkish
  • ◼
  • Indian
  • ◼
  • Ethiopian
  • ◼
  • Egyptian
  • ◼
  • Kenyan
  • ◼
  • Chinese
  • ◼
  • Thai
  • ◼
  • Brazilian
  • The goal is to capture the most representative and commonly recognized dishes from each cuisine, rather than obscure or highly specialized recipes. Include a broad range of dishes, such as main courses, soups, stews, side dishes, baked goods, desserts, sauces, etc.
    ​
    For every recipe, extract the complete ingredient list. Then normalize each ingredient against my predefined ingredient list. Ingredient normalization is important. Different recipes may use different names, languages, spellings, or levels of specificity for the same ingredient. For example, if my list contains “onion”, then “yellow onion”, “white onion”, “cebolla”, and “onions” should be mapped to “onion” when they refer to the same ingredient. Similarly, translate ingredients when necessary and map synonyms to the corresponding name in my list.
    For each cuisine, record:
    1. The cuisine/cultural category.
    2. The recipe name.
    3. The source URL.
    4. The original ingredients list as written in the recipe.
    5. The normalized ingredients from my ingredient list that occur in the recipe.
    6. The unmatched ingredients
    Important methodological requirements:
    ◼
  • Prefer reputable recipe websites, culinary institutions, cookbooks or databases, and established food publications.
  • ◼
  • Avoid using multiple copies of essentially the same recipe.
  • ◼
  • Avoid counting different versions of the same recipe as independent recipes.
  • ◼
  • Prefer recipes that are representative of the cuisine.
  • ◼
  • Keep the cuisines separate throughout the analysis.
  • ◼
  • Preserve the source URL for every recipe so that the data can be audited.
  • ◼
  • Do not silently discard ingredients. Keep the original ingredient name and the normalized ingredient name.
  • ◼
  • If an ingredient cannot confidently be mapped to an ingredient in my list, mark it as “unmatched” rather than guessing.
  • ◼
  • Keep a record of ambiguous mappings and explain why they were mapped or left unmatched.
  • ◼
  • Treat an ingredient as present if it occurs anywhere in the recipe’s ingredient list, regardless of quantity. The primary frequency measure should therefore be recipe-level presence/absence.
  • Output the results table “Recipe-level dataset”:
    ​
    | Cuisine | Recipe | Source | Original Ingredients list | Normalized Ingredient list | Unmatched Ingredient list | Notes |
    Using the ingredient list:
    In[]:=
    ingredientlist = VertexList[ResourceData["Flavor Network", "FlavorNetwork"]];
    In total, it took approximately 20 minutes to obtain recipes for the 15 cuisines, with 10 recipes selected for each cuisine. The resulting dataset contains the recipe name, cuisine, original ingredient list, and two ingredient lists: matched and unmatched ingredients.
    In[]:=
    dataset=Import["/Users/alejandraortizduran/Downloads/recipe-ingredient-dataset/dataset.csv"]
    The matched ingredient list contains ingredients that could be identified in the Flavor Network and were therefore available for the subsequent network analysis, while the unmatched ingredient list contains ingredients that could not be identified in the network and were retained for reference.

    LLFunction Recipe Extraction
    

    Cuisine Graphs

    Flavor

    Using the ingredients extracted from the recipes, we can construct a subgraph of the Flavor Network for each cuisine, containing only the ingredients that appear in its selected recipes. In this graphs, the edges connect pairs of ingredients that share flavor compounds, with edge weights representing the number of compounds shared between them. Additionally, the size of each vertex indicates how frequently the corresponding ingredient appears across the recipes for that cuisine.
    Out[]=
    This gives us a graph for each of the 15 cuisines, allowing us to visualize and compare their ingredient composition and the relationships between ingredients based on their shared chemical compounds.
    Based on these graphs, we can explore several aspects of the ingredient networks. For example, we can examine the distribution of edge weights to investigate how strongly ingredients are connected through shared flavor compounds and compare these distributions across cuisines using box plots.
    We can also look at the distribution of the number of ingredients per recipe using histograms:

    Graph Metrics and Comparison of the Cuisines

    We can also use various graph-theoretic metrics to characterize and compare the ingredient networks across the different cuisines:
    The VertexCount indicates the number of ingredients appearing in each cuisine’s graph. British cuisine has the highest number of ingredients (53), followed by Thai cuisine (50). The EdgeCount indicates the number of flavor-similarity connections between ingredients. British cuisine also has the highest edge count (947), followed by Greek cuisine (817). The GraphDensity measures how densely the ingredients are connected relative to the number of possible connections. In this case, Italian cuisine has the highest graph density. Finally, ConnectedGraphQ indicates whether a graph is connected or disconnected. Several cuisines have disconnected networks, meaning they contain separate groups of ingredients with no flavor-sharing paths connecting them. Here, the interesting observation is that the number of ingredients does not necessarily determine how densely connected a network is. For example, British cuisine has the largest number of ingredients (53), but its graph is not connected.
    The GraphDiameter indicates the maximum shortest-path distance between any two ingredients. It tells us how far apart the most distant ingredients are within a cuisine’s flavor network. We can see that most cuisines have a diameter of 2 or 3. The GraphRadius represents the minimum eccentricity of any vertex, indicating how centrally located the most central ingredient is within the network. In this case, the radius is 2 for all of them. The vertex connectivity indicates how many vertices must be removed to disconnect the graph. British cuisine has the highest vertex connectivity (4), making it the most resilient to disconnection. Cuisines with a connectivity of 1 are more vulnerable to becoming disconnected. The same interpretation applies to edge connectivity, which measures the minimum number of edges that must be removed to disconnect the graph.

    Comparing peripheries with centers

    The GraphCenter are the group of most centrally located vertices based on their shortest-path distances to all other vertices.
    The GraphPeriphery identifies the group of vertices that are furthest from the rest of the network in terms of shortest-path distance. By comparing the peripheries of some cuisines with the centers of others, we can examine how ingredient positions vary across cuisines.
    One interesting pattern is that the peripheral ingredients of Spanish, Turkish, and Indian cuisines show relatively large overlaps with the centers of other cuisines. In contrast, the center of Brazilian cuisine overlaps strongly with the peripheries of other cuisines. This suggests that some ingredients can be central in one cuisine but peripheral in another.

    Comparing peripheries

    We can also compare the peripheries across different cuisine graphs.
    Interestingly, Indian and Spanish, Turkish and Spanish, and Indian and Turkish cuisines show the greatest overlap in their peripheral ingredients. This indicates that these cuisines share several ingredients that occupy peripheral positions in their respective networks, potentially reflecting similarities in how these ingredients are combined within their recipes.

    Comparing centers

    When comparing the centers of the different cuisine networks
    An interesting pattern emerges. Spanish cuisine shows the greatest difference from the others, possibly because of the presence of a particularly prominent central ingredient: apple.

    Ingredient Importance

    For ingredient importance, we can use the number of times an ingredient appears across the cuisines.
    We can observe that garlic and onion appear in all the cuisines, while tomato appears in about 14 cuisines, followed by black pepper and butter, which appear in 13 cuisines.

    Cuisine composition

    Another analysis we can do is examine the composition of each cuisine by classifying its ingredients into different categories, such as vegetables, meat, dairy, spices, oils, grains, fruits, and legumes. This would allow us to compare the composition of different cuisines and identify their characteristic ingredient types.

    Graph Communities

    FindGraphCommunities identifies groups of ingredients that are more strongly connected to one another than to the rest of the network. These groups reveal clusters of ingredients with stronger flavor relationships:

    Clustering coefficient

    The clustering coefficient measures the extent to which an ingredient’s neighbors are also connected to one another. In a flavor graph, high clustering means that ingredients tend to form tightly interconnected flavor groups.
    We can also compare the clustering coefficients across the different cuisine networks. All values are around 0.85, which is consistent with the mean clustering coefficient of the full Flavor Network:

    Independent vertex set

    FindIndependentVertexSet[g] identifies a set of vertices with no edges between them. This can be useful for finding ingredients that do not share flavor compounds with one another.
    It is interesting to see that ingredients such as olive oil and lemon juice appear in the independent vertex sets of most cuisines.

    Adjacency Matrix

    The WeightedAdjacencyMatrix[g] returns a matrix in which each entry represents the number of flavor compounds shared between two ingredients.
    This matrix can then be used to calculate the spectral radius, which is the largest absolute eigenvalue of the matrix. It provides a summary of the overall connectivity structure of the weighted flavor network, taking into account the strength of the connections between ingredients.
    We can see that Italian and Spanish cuisines have the highest eigenvalues.

    Fundamental cycles

    FindFundamentalCycles[g] finds the fundamental cycles associated with a spanning tree. These cycles help us identify recurring circular structures and understand how ingredients are interconnected within the network.

    Cycles

    FindCycle[g] finds a cycle in the graph. This can help us identify small network motifs and explore recurring patterns of connections between ingredients.

    Flavor Sub-Graph

    If we now combine all of the ingredients from the analyzed recipes, we can construct a larger graph containing only the ingredients that appear in at least one of the selected recipes. This gives us a subgraph of the full Flavor Network, allowing us to identify new patterns and relationships that may not be apparent when analyzing the cuisines separately.

    Graph Metrics of the Flavor Sub-Graph

    For the combined flavor graph, we obtain 189 vertices (ingredients) and 11,084 edges (ingredient co-occurrence relationships).
    The graph density is approximately 0.624, indicating that a relatively large proportion of possible ingredient pairs are connected.
    The graph diameter is 5, while the radius is 3.
    Based on this we can fin the periphery and the center.
    It is also interesting to examine the vertex degrees, as they show which ingredients appear most frequently in connections with other ingredients across the combined recipes. The degree distribution provides further insight into how ingredients are connected.
    The minimum degree is 2, the maximum degree is 170, and the mean degree is approximately 117.3. This shows considerable variation in the number of connections across ingredients, with some ingredients appearing alongside many others and others having much fewer connections.

    Centrality

    To further investigate ingredient importance, we can calculate different centrality measures, including DegreeCentrality[g], BetweennessCentrality[g], ClosenessCentrality[g], EigenvectorCentrality[g], and PageRankCentrality[g]. Each measure captures a different aspect of an ingredient’s position and influence within the network.
    Most of the centrality measures follow a similar pattern, identifying many of the same ingredients as structurally important in the network. Betweenness centrality, however, provides a different perspective by highlighting the ingredients that act as bridges between different parts of the network, connecting otherwise less-related groups of ingredients.

    Connectivity

    We can also visualize the shortest-path distances between all pairs of ingredients.
    The vertex and edge connectivity of the combined graph are both 2. This means that removing two vertices or two edges is sufficient to disconnect the network.
    From this, we can identify the vertex cut, and the edge cut. Removing either group would disconnect the graph into separate components.

    Cohesive groups

    We can also explore other structural properties such as the maximal cliques in the graph. These groups are particularly interesting because they represent ingredients that frequently occur together in recipes.
    The clique in the graph, allow us to examine specific groups of closely connected ingredients.
    We can also identify ingredients with no connections between them, highlighting combinations that do not appear together in the selected recipes:
    Identify groups of ingredients that are more strongly connected to one another than to the rest of the network:
    We can also visualize what the communities are made of:
    Or the fundamental cycles associated with a spanning tree, which can help reveal interesting recurring patterns of ingredient combinations.

    Recipe Graphs

    Ingredient usage graph

    Another way to construct the graph is to disregard the shared chemical compounds and instead connect ingredients based on whether they appear together in the same recipe. This gives us a completely different perspective on ingredient relationships, resulting in the following networks, that we call the ingredient usage graph:

    Graph Metrics and Comparison of the Cuisines

    Using these new graphs, where edges represent ingredients appearing together in recipes rather than shared chemical compounds, we can also calculate and compare several graph metrics:
    As we can see, the VertexCount remains unchanged, while the EdgeCount is different now. Indian and Thai cuisines now have the highest number of edges. Regarding the GraphDensity, most cuisines show lower values, with Indian cuisine having the highest density. And unlike the Flavor Network, all the ingredient usage graph are connected. This makes sense because ingredients are connected whenever they appear together in a recipe.
    There is no significant change in GraphDiameter or GraphRadius. However, the vertex and edge connectivity show some differences. In the ingredient usage graphs, Indian and Chinese cuisines have the highest connectivity, making them the most resilient to disconnection.

    Comparing peripheries with centers

    When comparing the peripheries with the centers across cuisines, we can see that Indian cuisine has a relatively large overlap between its peripheral ingredients and the centers of other cuisines.

    Comparing peripheries

    When comparing the peripheries across cuisines, we can see that Egyptian cuisine shares the largest number of peripheral ingredients with the other cuisines.

    Comparing centers

    When comparing the graph centers, we can see that Ethiopian, French, and Italian cuisines share the most central ingredients with other cuisines.

    Graph Communities

    These graphs can also be analyzed using community detection to identify groups of ingredients that frequently occur together:

    Clustering coefficient

    The clustering coefficient is around 0.85 for most cuisines.
    This is consistent with the mean clustering coefficient of the full ingredient usage Graph.
    Interestingly, this value is very similar to that obtained with the chemical-composition approach, suggesting that the main structural differences between the two approaches lie in the connections and communities they produce.

    Independent Vertex Set

    The independent vertex set becomes particularly interesting in the ingredient usage graph, as it identifies ingredients that do not appear together in the selected recipes. This can help highlight combinations that are less common and may be worth avoiding.

    Adjacency matrix

    The adjacency matrices look different in the ingredient usage graphs.
    And their eigenvalues also change accordingly.

    Fundamental cycles

    The fundamental cycles becomes particularly interesting in the ingredient usage graph because the cycles highlight groups of ingredients that frequently appear together in recipes.

    Cycles

    Similarly, cycles can reveal recurring ingredient combinations, and help us to explore small groups of ingredients that tend to be used together.

    Combined recipe ingredient graph

    We can also combine all the individual cuisine graphs into a single network based on the recipes, connecting ingredients whenever they appear together in a recipe, regardless of cuisine.
    We can then use graph-theoretic tools such as clique finding to identify groups of ingredients that consistently occur together. This also allows us to explore whether community detection can identify groupings that correspond to recognizable cuisines, or whether it reveals relationships between ingredients across cuisines that may not be immediately apparent to us.

    Graph Metrics

    The combined Recipe Usage Graph contains 191 ingredients (vertices) and 7,032 connections (edges), with a graph density of approximately 0.736.
    We can also examine the graph diameter and radius to identify the periphery and center of the combined network.
    The periphery consists of three ingredients: carrot, berry, and yeast.
    The graph center includes ingredients such as capsicum annuum, black pepper, cumin, onion, olive oil, cilantro, and coriander, among others.
    We can also examine the vertex degrees.
    The minimum degree is 2, the maximum is 77, and the mean degree is approximately 60.36. These values show how the number of connections varies across ingredients in the combined graph.

    Centrality

    We can also examine the different centrality measures to identify the most important ingredients in the combined network, considering their connectivity, position, and influence within the graph.

    Connectivity

    We can also visualize the shortest-path distances between all pairs of ingredients.
    From this distance matrix, we can further examine the network’s robustness using VertexConnectivity[g and EdgeConnectivity[g], as well as identify the vertices and edges whose removal would disconnect the graph using FindVertexCut[g] and FindEdgeCut[g].

    Cohesive groups

    We can also identify all maximal cliques, highlighting groups of ingredients that are all connected through shared recipes.
    We can identify ingredients that do not appear together in the selected recipes, potentially highlighting combinations that are less common.
    Identify groups of ingredients that are more strongly connected to one another:
    We can also visualize what the communities are made of:
    And identify cycles that can reveal groups of ingredients that frequently appear together in recipes:

    Conclusion

    We have examined how graph theory and graph coloring techniques can be adapted to help analyze different cuisines. By representing flavor profiles as a graph of ingredients, where ingredients are represented as vertices and edges connect ingredients based on their shared flavor compounds or if they are used on the same recipe, we can provide a structured and systematic method for analyzing these relationships. This makes graph-based approaches particularly useful for exploring and managing complex relationships between ingredients. Beyond this application, graph-theory metrics and analysis have broad applications in problem solving, providing powerful tools for addressing not only problems related to food and cooking, but also a wide range of real-world problems that can be modeled as graph-based challenges.

    Acknowledgments

    I would like to thank the creators of the Flavor Network and the team behind the database for making these data publicly available. Without this valuable resource, this project would not have been possible.
    I would also like to thank Luke Fox for his input and help running the recipe extraction using his Claude Max subscription, which made the large-scale recipe collection possible. Without his help, this project might not have seen the light of day for another year!

    References

    1
    .
    Flavor network and the principles of food pairing by Y.-Y. Ahn, S. Ahnert, J. P. Bagrow, and A.-L. Barabási, Scientific Reports 1, 196 (2011).
    2
    .
    *Flavor-Network* Cheng, L. GitHub repository. Available at: https://github.com/lingcheng99/Flavor-Network

    CITE THIS NOTEBOOK

    Exploring cuisine through graph theory: ingredient relationships and flavor networks​
    by Alejandra Ortiz Duran​
    Wolfram Community, STAFF PICKS, November 4, 2026
    https://community.wolfram.com/t/28496