summaryrefslogtreecommitdiffstats
path: root/twitter/dist.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2014-02-02 16:53:22 -0500
committerThibaut Horel <thibaut.horel@gmail.com>2014-02-02 16:53:22 -0500
commit7426d8ff0e7969eb1a86bdb5bec8a0c971309e2b (patch)
tree323d6a9a4423b51fbebb37c115fddeab1c7a9641 /twitter/dist.py
parenta0e95b0843d4e366e4b979685f7c821954afebc6 (diff)
downloadfast-seeding-7426d8ff0e7969eb1a86bdb5bec8a0c971309e2b.tar.gz
Facebook scraping
Diffstat (limited to 'twitter/dist.py')
-rw-r--r--twitter/dist.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/twitter/dist.py b/twitter/dist.py
new file mode 100644
index 0000000..8902869
--- /dev/null
+++ b/twitter/dist.py
@@ -0,0 +1,18 @@
+import sys
+import os.path
+
+
+def compute_dist(filename):
+ f = open(filename)
+ users = {}
+ for line in f:
+ values = line.strip().split()
+ users[values[0]] = int(values[2])
+ print sum(users.itervalues()) / float(len(users))
+
+ of = open(os.path.splitext(filename)[0] + "_dist.txt", "w")
+ for degree in users.itervalues():
+ of.write(str(degree) + "\n")
+
+if __name__ == "__main__":
+ compute_dist(sys.argv[1])