Get startedGet started for free

Exploring temporal structure

1. Exploring temporal structure

Up until now we've been just looking at one daily snapshot of the co-purchase graph. However we have access to four days of data. Let's start to think about how we can use all the data.

2. Are important products always important?

The first thing we'll need to do is extract all the unique dates from the raw data. We'll then build up our graph from the earliest date, in this case d[1].

3. Are important products always important?

Just like before, we'll find important vertices based on high out-degree and low in-degree. Finally, we'll be joining these vertices back to the data at each unique date so we'll store them as a data frame. Now we want to see how the important vertices look at each snapshot. To do this we'll need to do a few things.

4. Plotting important vertices at each date

First we'll create a list that will hold an igraph object at each time stamp. Because we want to plot at each time stamp all together, we'll set the graphical parameters so we have a 2x2 grid to plot on. Now we have to loop over each time stamp, creating a dataframe of important vertices from the first time stamp. We do this by filtering the raw data by date, and then joining that back on to the earlier data frame of important vertices we created. Next we create an igraph object and store it in a list. Lastly we plot that graph, setting the date as the main title.

5. Important vertices at each date

The earliest graph shows all the vertices meeting the criteria of being "important vertices", which is exactly what we'd expect. Looking at the next three weeks though we can notice a couple of things. First there's just many fewer vertices, meaning that those important vertices in the first week aren't even present. Secondly, later graphs include vertices that don't meet the criteria; they just have an out-degree of one or two. However we can see that a few are important across time.

6. Let's practice!

Now in the next lessons we'll be examining different metrics at each date and seeing how a graph can change (or not change) through time.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.