Last active
April 26, 2017 08:08
-
-
Save oxinabox/f652b0c28061221ec1f7b528e3272cd7 to your computer and use it in GitHub Desktop.
how to use backticks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```julia | |
| @everywhere function par(i, u) | |
| a=Dict{Int64, Array{Tuple{Int64,Int64},1}}() | |
| dum_a = Array{Tuple{Int64,Int64}}(0) | |
| # for i in 1:10 | |
| for j in 1:10 | |
| for k in 1:u | |
| push!(dum_a,(j,k)) | |
| end | |
| end | |
| a[i] = dum_a | |
| # end | |
| # println(length(a)) | |
| return a | |
| end | |
| @time Results = pmap((i) -> par(i,u), 1:10, 2) | |
| Result = merge(Results...) | |
| print(keys(Result)) | |
| ``` |
######################################################### LINKS of INdividuals ####################################################
@everywhere function LINKS_of_INdividuals(h, nodes_of_inds::Dict{Int64,Array{Tuple{Int64,Int64},1}}, graph::Dict{Int64,Vector{Int64}}, time_ticks::UnitRange{Int64})
ind_s_t_link_prob = Dict{Tuple{Int64,Int64, Int64, Int64}, Float64}()
# @parallel for h = 1:num_of_individuals
# for h = 1:20
for nodes in nodes_of_inds[h]
# println("h, nodeeeeeeeeeeeee ",h, " ", nodes[1], " ", nodes[2])
if nodes[2] == time_ticks[end]
continue
end
counter = 0
for neighbour in graph[nodes[1]]
# println("neighbour ", neighbour)
if (neighbour, nodes[2]+1) in nodes_of_inds[h]
counter += 1
end
end
for neighbour in graph[nodes[1]]
if (neighbour, nodes[2]+1) in nodes_of_inds[h]
# println(typeof(h), typeof(nodes[1]),typeof(neighbour) , typeof(nodes[2]+1))
ind_s_t_link_prob[h,nodes[1],neighbour,nodes[2]+1] = 1/counter
end
end
end
return ind_s_t_link_prob
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.