Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Edge = Struct.new(:from, :to)
- def get_tweep_connections_from tweets
- tweep_edges = {}
- tweets.each{ |tweet|
- tweep = tweet['from_user']
- to_nodes = extract_all_tweeps_from tweet
- if to_nodes.length > 0
- to_nodes.each{ |node|
- raise "node is blank!!" if node == ''
- edge_a = Edge.new(tweep, node)
- edge_b = Edge.new(node, tweep)
- if tweep_edges.has_key? edge_a
- tweep_edges[edge_a] += 1
- elsif tweep_edges.has_key? edge_b
- tweep_edges[edge_b] += 1
- else
- tweep_edges[edge_a] = 1
- end
- }
- end
- }
- return tweep_edges
- end
Add Comment
Please, Sign In to add comment