I am struggling with something which seems pretty trivial problem. Namely, I have a stochastic process on a random graph depending on the two parameters. The first parameter is the probability of an edge between two nodes of a random graph. The second parameter is the number of nodes in a certain state at the beginning of the process. The output is an integer function depending on those two parameters. I would like to get a surface plot
surface(p_edge, num_ian, my_function(p_edge, num_ian))
The following is really naive code which avoids custom indices but I am not 100 sure that p_edge and num_ian are mapped with the correct valued of the function. Ideally, I would like to iterate a 2D array over two directed linearly ordered sets instead of essentially introducing auxiliary variables to avoid custom index sets.
#!/usr/bin/julia
using Debugger
using Graphs
using SparseArrays
using StatsBase
using Statistics
using Plots;plotlyjs()
include("my_function.jl")
n = 200
p_edge = 0.01:0.01:0.5
num_ian = 10:1:100
target_surf = Matrix{Int64}(undef, size(p_edge,1), size(num_ian,1))
for i = 1:size(p_edge,1)
g = erdos_renyi(n, p_edge[i]; is_directed=true, seed=-1)
for j = 1:size(num_ian,1)
ia = sample(1:n,num_ian[j]; replace=false, ordered=true)
target_surf[i,j] = my_function(g,ia)
end
end
display(target_surf)
plot(p_edge, num_ian, target_surf, st = :surface, xlabel = "p_edge", ylabel = "num_ian", zlabel = "mine > 1")