Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
1c478957
Commit
1c478957
authored
Oct 24, 2018
by
Tiago Peixoto
Browse files
graph_blockmodel.hh: Small improvement to sample_block()
parent
f8af5762
Changes
1
Show whitespace changes
Inline
Side-by-side
src/graph/inference/blockmodel/graph_blockmodel.hh
View file @
1c478957
...
...
@@ -1730,7 +1730,7 @@ public:
// attempt random block
size_t
s
;
std
::
bernoulli_distribution
new_r
(
d
);
if
(
new_r
(
rng
)
&&
(
_candidate_blocks
.
size
()
-
1
<
num_vertices
(
_g
)))
if
(
d
>
0
&&
new_r
(
rng
)
&&
(
_candidate_blocks
.
size
()
-
1
<
num_vertices
(
_g
)))
{
if
(
_empty_blocks
.
empty
())
add_block
();
...
...
@@ -1750,12 +1750,6 @@ public:
}
return
s
;
}
else
{
s
=
uniform_sample
(
_candidate_blocks
.
begin
()
+
1
,
_candidate_blocks
.
end
(),
rng
);
}
if
(
!
std
::
isinf
(
c
)
&&
!
_neighbor_sampler
.
empty
(
v
))
{
...
...
@@ -1783,6 +1777,18 @@ public:
else
assert
(
size_t
(
_b
[
source
(
e
,
_g
)])
==
t
);
}
else
{
s
=
uniform_sample
(
_candidate_blocks
.
begin
()
+
1
,
_candidate_blocks
.
end
(),
rng
);
}
}
else
{
s
=
uniform_sample
(
_candidate_blocks
.
begin
()
+
1
,
_candidate_blocks
.
end
(),
rng
);
}
return
s
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment