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
d6716457
Commit
d6716457
authored
Jul 23, 2015
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "g" parameter to Nested/Overlap/CovariateBlockState.copy()
parent
60a97dff
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
src/graph_tool/community/blockmodel.py
src/graph_tool/community/blockmodel.py
+3
-3
src/graph_tool/community/covariate_blockmodel.py
src/graph_tool/community/covariate_blockmodel.py
+3
-3
src/graph_tool/community/nested_blockmodel.py
src/graph_tool/community/nested_blockmodel.py
+6
-4
src/graph_tool/community/overlap_blockmodel.py
src/graph_tool/community/overlap_blockmodel.py
+3
-3
No files found.
src/graph_tool/community/blockmodel.py
View file @
d6716457
...
...
@@ -243,14 +243,14 @@ class BlockState(object):
def
copy
(
self
,
b
=
None
,
B
=
None
,
deg_corr
=
None
,
clabel
=
None
,
overlap
=
False
):
def
copy
(
self
,
g
=
None
,
b
=
None
,
B
=
None
,
deg_corr
=
None
,
clabel
=
None
,
overlap
=
False
):
r
"""Copies the block state. The parameters override the state properties, and
have the same meaning as in the constructor. If ``overlap=True`` an
instance of :class:`~graph_tool.community.OverlapBlockState` is
returned."""
if
not
overlap
:
state
=
BlockState
(
self
.
g
,
state
=
BlockState
(
self
.
g
if
g
is
None
else
g
,
eweight
=
self
.
eweight
,
vweight
=
self
.
vweight
,
b
=
self
.
b
.
copy
()
if
b
is
None
else
b
,
...
...
@@ -260,7 +260,7 @@ class BlockState(object):
max_BE
=
self
.
max_BE
,
ignore_degrees
=
self
.
ignore_degrees
)
else
:
state
=
OverlapBlockState
(
self
.
g
,
state
=
OverlapBlockState
(
self
.
g
if
g
is
None
else
g
,
b
=
b
if
b
is
not
None
else
self
.
b
,
B
=
(
self
.
B
if
b
is
None
else
None
)
if
B
is
None
else
B
,
clabel
=
self
.
clabel
if
clabel
is
None
else
clabel
,
...
...
src/graph_tool/community/covariate_blockmodel.py
View file @
d6716457
...
...
@@ -468,11 +468,11 @@ class CovariateBlockState(BlockState):
self
.
__init__
(
**
state
)
return
state
def
copy
(
self
,
b
=
None
,
B
=
None
,
deg_corr
=
None
,
clabel
=
None
,
overlap
=
None
,
layers
=
None
,
ec
=
None
):
def
copy
(
self
,
g
=
None
,
b
=
None
,
B
=
None
,
deg_corr
=
None
,
clabel
=
None
,
overlap
=
None
,
layers
=
None
,
ec
=
None
):
r
"""Copies the block state. The parameters override the state properties, and
have the same meaning as in the constructor."""
state
=
CovariateBlockState
(
self
.
g
,
state
=
CovariateBlockState
(
self
.
g
if
g
is
None
else
g
,
ec
=
self
.
ec
if
ec
is
None
else
ec
,
eweight
=
self
.
eweight
,
vweight
=
self
.
vweight
,
...
...
src/graph_tool/community/nested_blockmodel.py
View file @
d6716457
...
...
@@ -158,11 +158,13 @@ class NestedBlockState(object):
" degree corrected,"
if
self
.
deg_corr
else
""
,
str
(
self
.
g
),
len
(
self
.
levels
),
str
([(
s
.
N
,
s
.
B
)
for
s
in
self
.
levels
]),
id
(
self
))
def
copy
(
self
,
ec
=
None
,
layers
=
None
,
deg_corr
=
None
,
overlap
=
None
,
clabel
=
None
):
def
copy
(
self
,
g
=
None
,
bs
=
None
,
ec
=
None
,
layers
=
None
,
deg_corr
=
None
,
overlap
=
None
,
clabel
=
None
):
r
"""Copies the block state. The parameters override the state properties, and
have the same meaning as in the constructor.."""
bs
=
[
s
.
b
.
a
for
s
in
self
.
levels
]
if
bs
is
None
:
bs
=
[
s
.
b
.
a
for
s
in
self
.
levels
]
if
overlap
is
None
:
overlap
=
self
.
overlap
elif
self
.
overlap
and
not
overlap
:
...
...
@@ -174,8 +176,8 @@ class NestedBlockState(object):
deg_corr
=
self
.
deg_corr
if
layers
is
None
:
layers
=
self
.
layers
return
NestedBlockState
(
self
.
g
,
self
.
eweight
,
self
.
v
weight
,
self
.
ec
if
ec
is
None
else
ec
,
bs
,
return
NestedBlockState
(
self
.
g
if
g
is
None
else
g
,
self
.
e
weight
,
self
.
vweight
,
self
.
ec
if
ec
is
None
else
ec
,
bs
,
layers
=
layers
,
deg_corr
=
deg_corr
,
overlap
=
overlap
,
clabel
=
clabel
,
max_BE
=
self
.
levels
[
0
].
max_BE
)
...
...
src/graph_tool/community/overlap_blockmodel.py
View file @
d6716457
...
...
@@ -254,13 +254,13 @@ class OverlapBlockState(BlockState):
self
.
partition_stats
=
libcommunity
.
overlap_partition_stats
()
def
copy
(
self
,
b
=
None
,
B
=
None
,
deg_corr
=
None
,
clabel
=
None
,
overlap
=
True
):
def
copy
(
self
,
g
=
None
,
b
=
None
,
B
=
None
,
deg_corr
=
None
,
clabel
=
None
,
overlap
=
True
):
r
"""Copies the block state. The parameters override the state properties, and
have the same meaning as in the constructor. If ``overlap=False`` an
instance of :class:`~graph_tool.community.BlockState` is returned."""
if
overlap
:
state
=
OverlapBlockState
(
self
.
g
,
state
=
OverlapBlockState
(
self
.
g
if
g
is
None
else
g
,
eweight
=
self
.
eweight
,
vweight
=
self
.
vweight
,
b
=
self
.
b
if
b
is
None
else
b
,
...
...
@@ -273,7 +273,7 @@ class OverlapBlockState(BlockState):
eindex
=
self
.
eindex
,
max_BE
=
self
.
max_BE
)
else
:
state
=
BlockState
(
self
.
base_g
,
state
=
BlockState
(
self
.
base_g
if
g
is
None
else
g
,
b
=
b
if
b
is
not
None
else
self
.
get_nonoverlap_blocks
(),
B
=
B
,
clabel
=
clabel
if
clabel
is
not
None
else
None
,
...
...
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