T2G 0.3: Visualize only RTs or mentions in Gephi

I just completed a new version of the Python version of T2G which adds a few new features. Most prominent among these is the ability to extract only retweets or only mentions for visualization in Gephi. Recent research has shown substantive differences between networks based on these behaviors, so it is important for researchers to be able to distinguish between them. The new version also fixes a bug that halted processing whenever two @s appeared adjacent to one another in a tweet (i.e. “@@”).

Download T2G 0.3 for Python (7/09/13)

T2G 0.3 features four extraction modes, each of which yields different sets of network edges:

  1. Extracts all edges, does not differentiate between retweets and mentions, and includes singletons (users who are mentioned by no one and mention no one)
  2. Extracts all edges, does not differentiate between retweets and mentions, and excludes singletons
  3. Extracts retweets only and excludes singletons
  4. Extracts mentions only (i.e. non-retweets) and excludes singletons

To try the different modes, change the value of the variable ‘extmode’ on line 16 to a number from 1 to 4 corresponding to the numbered modes above. Easy!


  1. I have very little Python experience and am looking for some guidance. I’m not sure how to use a script editor, if that’s what I need. I’m also not sure how to format the name of my Excel file to post into this script. Please help. Your tool is exactly what I am looking for.

  2. I’m back! Ok, so I had this working, but now I want to adjust the extraction in multiple ways. Can you explain the steps I would need to take to get this script to run? I thought I was supposed to copy the script into a script editor, but not sure what to do after that point. I have Python 2.7. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *