In [1]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
In [2]:
from preprocess import Preprocess
from analysis import *
In [3]:
pre = Preprocess('../tweet_input/tweets.txt')
pre.extract()
In [4]:
len(pre.df.index)
Out[4]:
In [42]:
# from itertools import islice, dropwhile
# islice()
# all_graphs(df, window=10.)
tweet_no = 11
g = get_graphs(pre.df, tweet_no,tweet_no+1, window=10.)
print len(g)
draw_lifted(g[0])
In [ ]:
get_times = lambda g: g.graph['time']
graph_gen = rolled_graph_gen(pre.df, start=8000, window=10.)
X = g_stats(graph_gen, mean_deg, get_times)
In [29]:
degrees, times = X[:,0], X[:,1]
plt.plot(degrees)
Out[29]:
In [30]:
plt.plot(times, degrees, '.')
plt.xticks(rotation=20)
# X.shape
Out[30]:
In [31]:
sns.distplot(degrees)
Out[31]:
In [28]:
graph_list = get_graphs(pre.df, window=10.)
In [32]:
draw_lifted(graph_list[0])
In [33]:
X = g_stats(graph_list, mean_deg, get_times)
degrees, times = X[:,0], X[:,1]
g = graph_list[np.argmax([degrees])]
print g.degree().values()
draw_lifted(g)
In [34]:
g = graph_list[np.argmin([degrees])]
print g.degree().values()
draw_lifted(g)
In [ ]: