Skip to content

Instantly share code, notes, and snippets.

@drewconway
drewconway / twitter_network.py
Created January 17, 2011 18:31
A function, which given a list of Twitter users, creates NetworkX object of relationships.
def twitter_network(users, api, user_type="search", alt_type="friend"):
"""
Given a list of Twitter users, create NetworkX object of relationships.
args: users List of Twitter users as strings
user_types Type string for entries in 'users'
"""
twitter_network=nx.DiGraph()
# Iteratively create network with appropriate type data
users=list(users)
for u in users: