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
410e8232
Commit
410e8232
authored
Jul 18, 2016
by
Tiago Peixoto
Browse files
graph_blockmodel.hh: Fix bug with neighbour sampler
This fixes a bug with isolated nodes that contain only self-loops.
parent
34dbc181
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/graph/generation/sampler.hh
View file @
410e8232
...
...
@@ -93,6 +93,7 @@ public:
}
size_t
size
()
const
{
return
_items
.
size
();
}
bool
empty
()
const
{
return
_items
.
empty
();
}
private:
...
...
src/graph/inference/graph_blockmodel.hh
View file @
410e8232
...
...
@@ -1261,9 +1261,10 @@ public:
// attempt random block
size_t
s
=
uniform_sample
(
_candidate_blocks
,
rng
);
if
(
!
std
::
isinf
(
c
)
&&
total_degreeS
()(
v
,
_g
)
>
0
)
auto
&
sampler
=
_neighbour_sampler
[
v
];
if
(
!
std
::
isinf
(
c
)
&&
!
sampler
.
empty
())
{
auto
u
=
sample_neighbour
(
_neighbour_
sampler
[
v
]
,
rng
);
auto
u
=
sample_neighbour
(
sampler
,
rng
);
size_t
t
=
_b
[
u
];
double
p_rand
=
0
;
if
(
c
>
0
)
...
...
Write
Preview
Markdown
is supported
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