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
6cccd783
Commit
6cccd783
authored
Dec 06, 2013
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct degree sequence description length in blockmodel.py
parent
2d574cb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
src/graph_tool/community/blockmodel.py
src/graph_tool/community/blockmodel.py
+10
-10
No files found.
src/graph_tool/community/blockmodel.py
View file @
6cccd783
...
...
@@ -297,10 +297,10 @@ class BlockState(object):
.. math::
\mathcal{L}_c = \mathcal{L}_t -
N\sum_kp_k\ln p
_k,
\mathcal{L}_c = \mathcal{L}_t -
\sum_rn_r\sum_kp^r_k\ln p^r
_k,
where :math:`p
_k` is the fraction of nodes with degree :math:`p_k`, an
d
we have instead :math:`k \to (k^-, k^+)` for directed graphs
.
where :math:`p
^r_k` is the fraction of nodes in block $r$ with degree :math:`k`. For directe
d
graphs we have instead :math:`k \to (k^-, k^+)`
.
If the "dense" entropies are requested, they will be computed as
...
...
@@ -378,15 +378,15 @@ class BlockState(object):
else
:
S
+=
model_entropy
(
self
.
B
,
N
,
E
,
directed
=
self
.
g
.
is_directed
(),
nr
=
self
.
wr
.
a
)
*
E
if
complete
and
self
.
deg_corr
:
if
self
.
deg_corr
:
S_seq
=
0
hist
=
defaultdict
(
int
)
hist
=
[
defaultdict
(
int
)
for
r
in
range
(
self
.
B
)]
for
v
in
self
.
g
.
vertices
():
hist
[(
v
.
in_degree
(),
v
.
out_degree
())]
+=
1
for
k
,
v
in
hist
.
items
(
):
p
=
v
/
float
(
self
.
g
.
num_vertices
())
S_seq
-=
p
*
log
(
p
)
S_seq
*=
self
.
g
.
num_vertices
()
hist
[
self
.
b
[
v
]][
(
v
.
in_degree
(),
v
.
out_degree
())]
+=
1
for
r
in
range
(
self
.
B
):
for
k
,
v
in
hist
[
r
].
items
():
p
=
v
/
float
(
self
.
wr
.
a
[
r
]
)
S_seq
-=
p
*
log
(
p
)
*
self
.
wr
.
a
[
r
]
S
+=
S_seq
return
S
/
E
...
...
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