-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
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) | ||
|
||
|
@@ -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), | ||
|