HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

R Tutorial : Network analysis in R: A tidy approach

15,103 views April 27, 2020 4:19

Watch on YouTube
ChannelDataCamp

Description from the creator

Want to learn more? Take the full course at learn.datacamp.com/courses/network-science-in-r… at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.

---

Welcome to this course on network analysis in R. My name is Massimo Franceschet and I teach data and network science. This course will teach you how to analyze and visualize network data in the R environment using the tidy approach.

Social networks such as Facebook and Twitter are popular examples of networks. Other examples include the Internet, the Web, academic citation networks like Google Scholar, and even the neural network in your brain. A network, or graph, is made of a set of nodes, or vertices, and a set of ties, also called edges, that connect pairs of nodes. In the figure, you see a network representing a website. The circles are the nodes, the webpages in this case, and the lines connecting the circles are the ties, the links between web pages.

Here you see a directed network with six nodes and eight directed ties. In a directed network, ties have a direction, that is, there are a source and a target node. An example is Twitter, where there are followers and followees. Here, Bob follows Emily, but Emily does not follow him. David and Emily follow each other.

This is an undirected network with six nodes and seven undirected ties. In an undirected network, ties don't have a particular direction. Facebook networks are undirected since friendship is a mutual relationship. Here, Emily and Alice are friends, also Alice and Bob are friends, but Emily and Bob are not friends.

Networks can also be weighted. In this case, the ties between nodes have weights assigned to them. On the Internet, tie weights might represent the connection bandwidth between routers. On Facebook, tie weights might correspond to the duration of a friendship. In the Facebook network here, Alice and Emily have been friends for two years, while Charles and David have been friends for four years.

In this course, you will take on the role of an Interpol Analyst to investigate the terrorist network behind the Madrid train bombing in 2004. This network was originally assembled by José Rodriguez from the University of Barcelona. The network nodes are terrorists involved in the attack. The ties are the connections between the terrorists. There are four types of ties: trust or friendship, links to Al Qaeda and Osama Bin Laden, co-participation in training camps or wars, and co-participation in previous terrorist attacks. The network is undirected and weighted.

In this course, we use a tidy approach to network science. We represent a network with two data frames: one for ties and one for nodes of the network. We will use the dplyr and ggplot2 packages to explore the properties of the network. Moreover, we will integrate these packages with igraph and ggraph packages, which we will use to analyze and visualize networks. For instance, the function graph_from_data_frame() builds a network from data frames. Moreover, the ggraph() function visualizes the network, by extending ggplot graphics using geometries for ties and nodes.

The igraph package has functions which allow you to explore the network directly. The V() function, which means vertices, prints the information about the network's nodes. vcount() provides a count of the number of nodes.The functions, E() and ecount(), do the same for ties; here "E" stands for edges.

You can add attributes directly to the network by using the network name, here "g", followed by the dollar sign and the attribute name. You can add node and tie attributes specifically by wrapping the network name in a function call to V() or E() for nodes and ties, respectively.

Let's start the investigation!

#DataCamp #RTutorial #NetworkAnalysis #NetworkAnalysisintheTidyverse

About this tutorial

DataCamp published this 4:19 video tutorial on April 27, 2020. It has been watched 15,103 times on YouTube.

Channel
DataCamp
Duration
4:19
Published
April 27, 2020
Views
15,103
Likes
66

Tags

Share

This tutorial in other languages