Section 3 – Network Visualization and Analysis: Case Study

Lesson 3 – Reading the Graph

In the previous lesson we created a graph that shows the foods and the nutrients contained in them. Knowing how to read a network graph can provide invaluable insights about the data that we encoded. It is also a good starting point to identify the points for more detailed and comprehensive analysis that will be done with more advanced software tools.

First of all, one of the most important things about the graph is the connectivity basis that it is constructed upon. In our case it’s the appearance of certain nutrients in certain foods. 

If we were to align the nodes and connections in a random manner, the graph would be unreadable as it would just be a random set of nodes and edges scattered in space. So the graph needs to be arranged in a way that would make sense. 

There are several layouts that are used in graph analysis, the most popular being Yifan Hu, circle layout and Force Atlas layout. In this presentation we are using the Force Atlas layout. The algorithm behind this layout pulls the nodes that are connected towards each other and pushes the disconnected nodes apart. The nodes with many connections are aligned far from each other around the space of the graph, while the other nodes that are connected to those central nodes are aligned around them. Like this we see the most prominent nodes in the graph and the communities that form around them.

Node communities in the food graph

Node communities in the food graph

In our example above there are two prominent “clusters” (nodes that are more densely connected together than with the rest of the network).

One such cluster is the top one with
“sweet potatoe”, “kale”, “vitamin c”, “vitamin a” etc.

Another cluster is at the bottom with
“calcium”, “iron”, “zinc”, “quinoa”, “almonds”

This information is very useful as it shows us that there is a group of foods (like sweet potatoes and kale) that contains vitamins and that there is another group of foods (like almonds and quinoa) that contains minerals. Therefore, for a healthy and balanced diets those two groups could be combined when making a recipe and cooking.

Another important property of the nodes in the graph is how well-connected they are. The representation we are using above ranges the nodes according to their degree: the number of connections a node has. The more connections, the bigger is the node. Therefore, the large nodes are the most connected ones:

Nodes with the highest degree in the graph

Nodes with the highest degree in the graph

In this case, it’s

Vitamin C,

How can this be interpreted? First of all, it means that Manganese and Vitamin C are contained in most foods that we have in the graph, meaning that no special emphasis on getting those nutrients should be taken as most likely they will already be in some of the foods that we select for the recipe.

Second, Broccoli and Spinach seem to contain many different nutrients and are very well connected to both clusters (the vitamins one and the minerals one). Therefore, it makes sense to often add those foods in the recipes for a healthy and balanced diet. 

One last thing we need to be aware of when interpreting a graph are the structural gaps between nodes and clusters. Those gaps indicate what’s missing from the graph and can point to potentially new interesting and inspiring connections to make. In our case – structural gaps are the potentially interesting combinations of foods that can bring together a very different set of nutrients together (and thus help towards creating a healthy diet).


In the graph above we can see that there’s a structural gap between the cluster around “brown rice” (which is mainly connected various minerals and vitamin B) and the “vitamin a” and “vitamin c” cluster, which are connected to foods like “red bell pepper”, “beet root”, “pineapple”, “mango”, “papaya”. Which could indicate that in order to design a nutrient-rich diet we could combine brown rice based dishes with desserts that contain pineapple, mangos and papayas to add more vitamins into the menu. Alternatively, brown rice could be served with red-pepper or beet root salads to provide nutrient-rich menu.