1. Learn
  2. /
  3. Courses
  4. /
  5. Case Studies: Network Analysis in R

Connected

Exercise

Important Products

We've now seen that there's a clear pattern in our graph. Let's take the next step and move beyond just understanding the structure. Given the context of graph structure, what can we learn from it? For example, what drives purchases? A place to start might be to look for "important products", e.g. those products that someone purchases and then purchases something else. We can make inferences about this using in degree and out degree. First, we'll look at our graph and see the distribution of in degree and out degree, and then use that to set up a working definition for what an "important product" is (something that has > X out degrees and < Z in degrees). We'll then make a subgraph to visualize what these subgraphs look like.

Instructions 1/2

undefined XP
    1
    2
  • Use degree() to calculate the "out' degrees of amzn_g by setting the mode to "out".
  • Calculate the "in" degrees in a similar manner.
  • Use table() to see the distribution of vertex "out" degrees.
  • Do the same for the "in" degrees.