Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Unfolded Graph
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EcoEpi
Unfolded Graph
Merge requests
!5
Add binary for post-hoc simulations of SIS epidemics
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add binary for post-hoc simulations of SIS epidemics
post-hoc-simulation
into
main
Overview
0
Commits
5
Pipelines
2
Changes
7
Merged
Adam Reichold
requested to merge
post-hoc-simulation
into
main
3 years ago
Overview
0
Commits
5
Pipelines
2
Changes
7
Expand
👍
0
👎
0
Merge request reports
Compare
main
version 1
6d1816b0
3 years ago
main (base)
and
latest version
latest version
7b6c484e
5 commits,
3 years ago
version 1
6d1816b0
4 commits,
3 years ago
7 files
+
179
−
109
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
src/bin/deg.rs
+
18
−
7
Options
@@ -8,12 +8,13 @@ use std::env::args;
use
unfolded_graph
::{
read_aggregated_graph
,
Time
,
ZwoHashMap
};
const
USAGE
:
&
str
=
"usage: deg <resolution> <until> < <graph.bin> > <histograms.csv>"
;
const
USAGE
:
&
str
=
"usage: deg <resolution> <until>
<weighted>
< <graph.bin> > <histograms.csv>"
;
fn
main
()
{
let
mut
args
=
args
();
let
resolution
=
args
.nth
(
1
)
.expect
(
USAGE
)
.parse
::
<
Time
>
()
.expect
(
USAGE
);
let
until
=
args
.next
()
.expect
(
USAGE
)
.parse
::
<
Time
>
()
.expect
(
USAGE
);
let
weighted
=
args
.next
()
.expect
(
USAGE
)
.parse
::
<
bool
>
()
.expect
(
USAGE
);
// Read the aggregated graph up to the given time limit.
let
aggregated_graph
=
read_aggregated_graph
(
0
,
resolution
,
until
);
@@ -21,12 +22,22 @@ fn main() {
// Collect two histograms of the outgoing and incoming node degrees.
let
mut
values
=
ZwoHashMap
::
<
usize
,
(
usize
,
usize
)
>
::
default
();
for
(
_node
,
out_deg
)
in
aggregated_graph
.out_degrees
()
{
values
.entry
(
out_deg
)
.or_default
()
.0
+=
1
;
}
for
(
_node
,
in_deg
)
in
aggregated_graph
.in_degrees
()
{
values
.entry
(
in_deg
)
.or_default
()
.1
+=
1
;
if
weighted
{
for
(
_node
,
out_deg
)
in
aggregated_graph
.weighted_out_degrees
()
{
values
.entry
(
out_deg
)
.or_default
()
.0
+=
1
;
}
for
(
_node
,
in_deg
)
in
aggregated_graph
.weighted_in_degrees
()
{
values
.entry
(
in_deg
)
.or_default
()
.1
+=
1
;
}
}
else
{
for
(
_node
,
out_deg
)
in
aggregated_graph
.out_degrees
()
{
values
.entry
(
out_deg
)
.or_default
()
.0
+=
1
;
}
for
(
_node
,
in_deg
)
in
aggregated_graph
.in_degrees
()
{
values
.entry
(
in_deg
)
.or_default
()
.1
+=
1
;
}
}
// Make sure that they are no gaps in the histograms.
Loading