Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
e8be2a92
Commit
e8be2a92
authored
Jul 13, 2019
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate_maxent_sbm(): Fix problem with directed graphs without self-loops
parent
25c7ee92
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/graph/generation/graph_maxent_sbm.hh
src/graph/generation/graph_maxent_sbm.hh
+8
-3
No files found.
src/graph/generation/graph_maxent_sbm.hh
View file @
e8be2a92
...
...
@@ -540,13 +540,16 @@ void gen_maxent_sbm(Graph& g, VProp b, IVec&& rs, IVec&& ss, MVec& mrs,
std
::
vector
<
gt_hash_map
<
double
,
std
::
vector
<
size_t
>>>
vertices_in
(
B
),
vertices_out
(
B
);
gt_hash_set
<
std
::
tuple
<
double
,
double
>>
theta_l
;
for
(
auto
v
:
vertices_range
(
g
))
{
auto
r
=
b
[
v
];
if
(
theta_in
[
v
]
>
0
)
vertices_in
[
b
[
v
]
][
theta_in
[
v
]].
push_back
(
v
);
vertices_in
[
r
][
theta_in
[
v
]].
push_back
(
v
);
if
(
theta_out
[
v
]
>
0
)
vertices_out
[
b
[
v
]][
theta_out
[
v
]].
push_back
(
v
);
vertices_out
[
r
][
theta_out
[
v
]].
push_back
(
v
);
theta_l
.
insert
({
theta_out
[
v
],
theta_in
[
v
]});
}
gt_hash_set
<
std
::
pair
<
size_t
,
size_t
>>
sampled
;
...
...
@@ -571,7 +574,7 @@ void gen_maxent_sbm(Graph& g, VProp b, IVec&& rs, IVec&& ss, MVec& mrs,
throw
GraphException
(
"Invalid probability: "
+
lexical_cast
<
string
>
(
p
));
size_t
n
;
if
(
r
==
s
&&
vout
.
first
==
vin
.
first
)
if
(
r
==
s
&&
theta_l
.
find
({
vout
.
first
,
vin
.
first
})
!=
theta_l
.
end
()
)
{
n
=
vout
.
second
.
size
()
*
(
vin
.
second
.
size
()
-
1
);
if
(
!
graph_tool
::
is_directed
(
g
))
...
...
@@ -583,8 +586,10 @@ void gen_maxent_sbm(Graph& g, VProp b, IVec&& rs, IVec&& ss, MVec& mrs,
{
n
=
vout
.
second
.
size
()
*
vin
.
second
.
size
();
}
std
::
binomial_distribution
<
size_t
>
d
(
n
,
p
);
size_t
nedges
=
d
(
rng
);
for
(
size_t
i
=
0
;
i
<
nedges
;
++
i
)
{
size_t
u
,
v
;
...
...
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