Skip to content

Instantly share code, notes, and snippets.

@rjurney
Created May 13, 2011 01:39
Show Gist options
  • Save rjurney/969821 to your computer and use it in GitHub Desktop.
Save rjurney/969821 to your computer and use it in GitHub Desktop.
Playing with Enron Summaries
#!`which jruby`
require 'rubygems'
require 'pacer'
graph = Pacer.tg
graph.import("/tmp/enron_summary.xml")
# Focus on one email address, that of Tim Belden
sender = graph.get_vertices.filter(:address => 'tim.belden@enron.com')
# Check the vertex's properties
sender.inspect
# Look into the volume of emails Tim sent to each address
sender.out_e
sent = sender.
sent.lookahead {|s| puts "#{s.in_v.v[:address]} #{s[:volume]}"}
groupings = sender.v.group.key_route{ |email| email[:address] }.values_route(:email) { |email| [email.out_e.in_v[:address], email.out_e[:volume] ] }
sender.v.out_e.e.group.key
result = groupings.reduce(proc { Hash.new(0) }, :email) { |h, e| h[e] += 1; h }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment