Exploring a personal Twitter network

·
network graph
PDF version
  1. Fetch the IDs of users I follow on Twitter, using vege-table:

    
    var url = 'https://api.twitter.com/1.1/friends/ids.json';
    
    var params = {
      screen_name: ‘invisiblecomma’,
      stringify_ids: true,
      count: 5000
    };
    
    var collection = new Collection(url, params);
    
    collection.items = function(data) {
      return data.ids;
    }
    
    collection.next = function(data) {
      if (!data.next_cursor) {
        return null;
      }
    
      params.cursor = data.next_cursor_str;
    
      return [url, params];
    }
    
    return collection.get('json');
  2. Using similar code, fetch the list of users that each of those users follows.

  3. Export the 10,000 user IDs with the highest intra-network follower counts.

  4. Fetch the details of each Twitter user:

    return Resource('https://api.twitter.com/1.1/users/lookup.json', {
      user_id: user_id
    }).get('json').then(function(data) {
      return data[0];
    });
  5. Process those two CSV files into a list of pairs of connected identifiers suitable for import into Gephi.

  6. In Gephi, drag the “Topology > In Degree Range” filter into the Queries section, and adjust the range until a small enough number of users with the most followers is visible:

    filter screenshot
  7. Set the label size to be larger for users with more incoming links:

    label size screenshot
  8. Set the label colour to be darker for users with more incoming links:

    label colour screenshot
  9. Apply the ForceAtlas 2 layout, then the Expansion layout a few times, then the Label Adjust layout:

    layout screenshot
  10. Switch to the Preview window and adjust the colour and opacity of the edges and labels appropriately. Hide the nodes, set the label font to Roboto, then export to PDF.

  11. Use imagemagick to convert the PDF to JPEG: convert —density 200 twitter-foaf.pdf twitter-foaf.jpg

It would probably be possible to automate this whole sequence - perhaps in a Jupyter Notebook. The part that takes the longest is fetching the data from Twitter, due to the low API rate limits.