Video summary

Tutorial 4 Social Network Analysis

Main summary

Key takeaways

Educational

Summary

The tutorial explains how to represent social-media relationships as graphs, collect a Twitter followee network, analyze it using basic social-network metrics, and visualize it with Gephi.

Graphs and Social-Media Data

A graph consists of nodes and edges:

  • Nodes represent entities such as users, pages, or groups.
  • Edges represent relationships. For example, a directed edge from user A to user B may indicate that A follows B.

The example network represents a person’s Twitter followees, with edges indicating whom those accounts follow. The tutorial introduces three ways to represent graphs: adjacency matrices, GraphML, and CSV files.

Graph Representation Formats

Adjacency Matrix

An adjacency matrix is a square, two-dimensional matrix with one row and one column per node. A cell contains 1 if an edge exists from the row’s node to the column’s node, and 0 otherwise.

It is straightforward to build using an array, but can waste space when a graph has many nodes and relatively few edges.

GraphML

GraphML is an XML-based graph file format. A graph element contains node and edge elements. Each node has a distinct ID, and each edge has source and target attributes that identify its endpoints.

The tutorial uses a GraphML file to store the Twitter network for visualization.

Collecting a Twitter Network with Twecoll

The demonstration uses Twecoll, a command-line tool, to collect followee and friends-of-friends information.

  1. Obtain the Twecoll code by downloading and unzipping it, or by cloning its repository.
  2. Open a terminal and navigate to the folder containing the code.
  3. Initialize Twecoll and authorize a Twitter application:
    • Run python twecoll init followed by the username.
    • When prompted, provide the application’s consumer key and consumer secret from the Twitter application settings.
    • Open the authorization URL, approve the application, and enter the resulting PIN in the terminal.
  4. Let the program process the account’s followee IDs.
  5. Fetch friends-of-friends information by running python twecoll fetch followed by the username.
  6. Generate edges between followees and their followees by running python twecoll edgelist followed by the username.
  7. Check for a generated .GML file named with the username. The tutorial notes that a missing igraph module warning may appear, but says the GML file may still be present.

Social-Network Analysis Concepts

  • In-degree: The number of edges entering a node. In a Twitter follower graph, this can indicate how many accounts follow a user.
  • Out-degree: The number of edges leaving a node. In a follow graph, this represents how many accounts a user follows.
  • Total degree: The sum of a node’s in-degree and out-degree. In the example, a self-loop contributes to both.
  • Centrality: A way of identifying important or central nodes. The tutorial describes:
    • In-degree centrality: Finds nodes with the highest in-degree.
    • Out-degree centrality: Finds nodes with the highest out-degree.
    • Betweenness centrality: Counts how often a node lies on shorter paths between other nodes.
    • Closeness centrality: Identifies nodes with low total distance to all other nodes.
  • Communities and modularity: A community is a group of similar or strongly connected nodes. Modularity measures how strongly edges fall within groups.

Visualizing and Exploring the Graph in Gephi

  1. Download and install Gephi, then open the generated GraphML file.
  2. Review the graph’s node and edge counts. If the visualization does not appear, open the Overview workspace.
  3. If the graph is dense, try a different layout. The demonstration uses the Reingold layout and runs it briefly.
  4. Use the statistics panel to run analyses such as average degree, average weighted degree, network diameter, degree distribution, and modularity.
  5. Customize the display:
    • Show node labels using the T control.
    • Color nodes by modularity class to distinguish communities.
    • Size nodes by in-degree to highlight nodes with many incoming edges.
    • Adjust the edge appearance in Preview. The demonstration selects a curved-edge preset and refreshes the view.
  6. Export the visualization as SVG, PDF, or PNG.
  7. Use Data Laboratory to inspect node information and edge source–target relationships.

The tutorial’s overall workflow is to collect social-network data, represent it as a graph file, analyze its structure, and visualize the resulting network.

Speakers and Sources

  • Speaker: One instructor or narrator; no other speakers are identified.
  • Platforms, tools, and formats: Twitter, Twecoll, GraphML/GML, Gephi, XML, adjacency matrices, CSV, and igraph.

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video