alumbreras / twitter-followers-graph

A set of scripts to analyze networks in Twitter (neighbourhoods, participants in a hashtag, etc)
MIT License
47 stars 9 forks source link

Condor

A toolkit to analyse tweets and users who tweet.

Egonets

Description

Fetch the followers of a user and the following relationship between them. Create a graph file with this graph.

Usage

You are supposed to have a config.yml file in the same directory, with your keys to access the API. Such as:

CONSUMER_KEY: 6it3IkPFI4RNIGhIci1w
CONSUMER_SECRET: zGUE1bTucHcNn5IxFNyBP8dN2EvbrMtij5xuWHqcW0

Then there are three functions to be executed secuentially:

Fetches the followers/followees of user and their followers as well. Store them into files. By storing them into files we can, at different executions, check whether the user had already been fetched and avoid unnecessary API calls.

Due to the API rate limitations, we can only fetch the followers of 15 users in a 15 minutes window. Thus, for a user with 1000 followers it requires 1000 minutes to complete.

Nonetheless, the script can be stoped at any time and the final graph will contain only those followers whose followers have been fetched.

Fetches the screen names of the followers/followees and store them into files. It allows the final graph to contain the screen names and therefore Gephi can plot them instead of the user ids.

If the screen name of a user is not fetched, the graph() function will assign its id as screen name.

This is very cheap in terms of API calls since we can retrieve 100 screen names per call.

Builds a graph file (graphML format) form the information stored in files (followers and screen names). The graph can be directly opened by Gephi.

Once in Gephi

Once in Gephi, I recommend the following steps (I assume you know how to do this):

Have fun!

ego alberto_lm

Keyword Communities

Reproduces the social network of the users who tweeted a given keyword

A typical use case: :

JSON files should be properly closed by hand (leading and ending brackets)