-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviz.rel
49 lines (41 loc) · 1.19 KB
/
viz.rel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
module se_viz
@inline def plot_bars[DS, xtitle, ytitle, title] =
vegalite:plot[
vegalite:bar[
{
:x;
:type, "ordinal";
:sort, "y";
:title, xtitle
},
{
:y;
:type, "quantitative";
:aggregate, "identity";
:title, ytitle;
},
{
:data, se_util:to_gnf[DS, {:x, :y}];
:title, title
}
]
],
arity[DS] = 2
@inline def get_top[GM, n] =
transpose[bottom[n, transpose[GM]][_]]
@inline def plot_top_bars[GM, n, xtitle, ytitle, title] =
plot_bars[get_top[GM, n], xtitle, ytitle, title]
@inline def plot_graph_degree_histogram[G, bin_step] =
vegalite:plot[
vegalite:bar[
{
:degree;
:bin, boolean_true;
:bin, :step, bin_step
},
{ :aggregate, "count" },
{ :data, {:degree, i, dgr: enumerate[rel:graphlib[G][:degree]](i, _, dgr)} }
]
],
se_graph:is_graph[G]
end