Social Network Analysis Recipe 1.13, 1.14 2013. 04. 22 Choi Dong-Soo mycds88@koreatech.ac.kr
Recipe 1.13 1.13 Harvesting Friends and Followers Problem Solution You want to harvest all of the friends or followers for a particular user. Solution Use the robust make_twitter_request function from Recipe 1.9 to collect all of the friend or follower ids via a long-running process.
Recipe 1.13
Recipe 1.13 REST API v1.1 Limits per window by resource For example, 15 requests per hour at 5,000 ids per request works out to be 300 thousand ids per hour.
Recipe 1.13 Cursor Tuple(Previous_Cursor, Next_Cursor)
Recipe 1.13 File Name oauth ID Screen Name Max ids 0:Friends / 1:Followers
Recipe 1.13 Result Friends
Recipe 1.13 Result Followers
Recipe 1.14 1.14 Performing Setwise Operations on Friendship Data Problem You want to operate on collections of friends and followers to answer questions such as “Who isn’t following me back?”, “Who are my mutual friends?”, and “What friends/followers do certain users have in common?”. Solution Use setwise operations such as the difference and intersection operations to answer these questions.
Recipe 1.14 Redis Install : http://redis.io/download http://itips.tistory.com/2 Install : http://redis.io/download Commands : http://redis.io/commands
Recipe 1.14 sadd () scard() sdiffstore() sinterstore() Add one or more members to a set scard() Get the number of members in a set sdiffstore() Subtract multiple sets and store the resulting set in a key sinterstore() Intersect multiple sets and store the resulting set in a key http://itips.tistory.com/2
Recipe 1.14 Oisoo 30000 24728 30000 friend_ids follows_ids http://itips.tistory.com/2
Recipe 1.14 Result http://itips.tistory.com/2
Recipe 1.14 24527 201 29799 friend_ids follows_ids http://itips.tistory.com/2
Thank you.