Skip to content

Commit

Permalink
yet better example
Browse files Browse the repository at this point in the history
  • Loading branch information
emfeltham committed Feb 22, 2022
1 parent 1fbb01c commit 9f26f7a
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions example.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
# without module, do:
# using Graphs, MetaGraphs
# using CairoMakie, GraphMakie, NetworkLayout, Colors, ColorSchemes

# # load package functions
# include("radius.jl")
# include("sampling.jl")
# include("plotting.jl")
# include("context.jl")
# include("whole_network.jl")
# example.jl
# author: eric martin feltham, [email protected]
# date: 2022-02-21

using Graphs, MetaGraphs, SamplingPerceivedNetworks

# setup the test network
## setup the test network
graph = watts_strogatz(100, 4, 0.3)
graph = MetaGraph(graph)

Expand All @@ -20,43 +13,43 @@ for i in 1:nv(graph)
set_prop!(graph, i, :name, "John" * "_" * string(i))
end

# end setup
## end setup test network

# choose a vertex, and a maximum degree
v = 1; dₘₐₓ = 4;

get_prop(graph, v, :name)
get_prop(graph, v, :name) # check the vertex name

rad = vertexradius(graph, v, dₘₐₓ);
rad = vertexradius(graph, v, dₘₐₓ); # generate the social radius of v

# pick degree to view
d = 1
radiusd = vertexradius_d(rad, d);

# check the included nodes at d
[get_prop(radiusd, vtx, :name) for vtx in vertices(radiusd)]

plot_radius_d(radiusd)

# plot the social radius of v on the whole network
gcon = context_graph(graph, radiusd, v; index = true);

f_cont = plot_context(gcon);

CairoMakie.save("context.svg", f_cont, px_per_unit = 2)

#=
tasks:
1. context graph []
2. sampling from radius [DONE]
sample from each real, fake for each d
with option to keep degree and real-fake status
=#
# sampling

bins = samplingbins(rad)

# more info: dels, real_ls
cogls, degls, real_ls = samplebins(
bins;
desired = ((10, 10), (5, 5), (5, 5)), dvals = (1:2, 3, 4),
moreinfo = true
);

# sampling list for each vertex in the network
vertlists = samplenetwork(
graph;
desired = ((10, 10), (5, 5), (5, 5)), dvals = (1:2, 3, 4),
Expand Down

0 comments on commit 9f26f7a

Please sign in to comment.