Video summary
Tutorial 4 Social Network Analysis
Main summary
Key takeaways
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.
- Obtain the Twecoll code by downloading and unzipping it, or by cloning its repository.
- Open a terminal and navigate to the folder containing the code.
- Initialize Twecoll and authorize a Twitter application:
- Run
python twecoll initfollowed 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.
- Run
- Let the program process the account’s followee IDs.
- Fetch friends-of-friends information by running
python twecoll fetchfollowed by the username. - Generate edges between followees and their followees by running
python twecoll edgelistfollowed by the username. - Check for a generated
.GMLfile named with the username. The tutorial notes that a missingigraphmodule 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
- Download and install Gephi, then open the generated GraphML file.
- Review the graph’s node and edge counts. If the visualization does not appear, open the Overview workspace.
- If the graph is dense, try a different layout. The demonstration uses the Reingold layout and runs it briefly.
- Use the statistics panel to run analyses such as average degree, average weighted degree, network diameter, degree distribution, and modularity.
- Customize the display:
- Show node labels using the
Tcontrol. - 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.
- Show node labels using the
- Export the visualization as SVG, PDF, or PNG.
- 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.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.