Ejemplo n.º 1
0
                break


print("Cascade : ", cascade)

# Author dict creation
if cascade:
    print("LastPublisher dict creation...")
else:
    print("Author dict creation...")
Author = util.get_authors(data_path)


# GET LAMBDAS MUS AND GRAPH
print("Getting lambdas and mus...")
Rtweet, Rrtweet, total_time = util.get_activity(data_path, cascade, Author, divide_by_time=True, retweeted=False)
print("Getting leaders and followers...")
LeadGraph, FollowGraph = util.graph_from_trace(data_path, cascade, Author)

# list of users
Lusers = list(Rtweet.keys())
Lusers.sort()
N = len(Lusers)


# ## 3. Performance evaluation
# From the Linear System solution, one realises that it is necessary to first populate the matrices $A$ and $C$, which are relevant for any solution process of the system. 
# **Note** We will keep in memory Dictionaries, with Key the userid and value the list of positive matrix entries.


# ### Build matrix A in sparse format
Ejemplo n.º 2
0
for line in open(psi_star):  # oursin
    line = line.split()
    user, psi = int(line[0]), float(line[1])
    if user in Psi['real']:
        Psi['star'][user] = psi
del user, psi

# load authors
print("Getting authors...")
Author = util.get_authors(trace_path)

# load activity
print("Getting activity...")
Lambda, Mu, total_time = util.get_activity(trace_path,
                                           False,
                                           Author,
                                           divide_by_time=True,
                                           retweeted=False)
del Mu, total_time
Lambda = {u: Lambda[u] for u in Psi['real']}

# load star graph
print("Getting follow graph (star)...")
FollowGraph = dict()
_, FollowGraph['star'] = util.graph_from_trace(trace_path, False, Author)
del _, Author
FollowGraph['star'] = {
    u: {v
        for v in FollowGraph['star'][u] if v in Psi['real']}
    for u in Psi['real']
}