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
ab9168fb
Commit
ab9168fb
authored
Apr 03, 2018
by
Tiago Peixoto
Browse files
UncertainBaseState: Implement get_graph() method
parent
e089bebb
Changes
1
Show whitespace changes
Inline
Side-by-side
src/graph_tool/inference/uncertain_blockmodel.py
View file @
ab9168fb
...
...
@@ -23,7 +23,8 @@ import sys
if
sys
.
version_info
<
(
3
,):
range
=
xrange
from
..
import
_degree
,
_prop
,
Graph
,
GraphView
,
libcore
,
_get_rng
,
PropertyMap
from
..
import
_degree
,
_prop
,
Graph
,
GraphView
,
libcore
,
_get_rng
,
\
PropertyMap
,
edge_endpoint_property
from
..
dl_import
import
dl_import
dl_import
(
"from . import libgraph_tool_inference as libinference"
)
...
...
@@ -178,6 +179,17 @@ class UncertainBaseState(object):
self
.
_state
.
get_edges_prob
(
elist
,
probs
,
ea
,
epsilon
)
return
probs
def
get_graph
(
self
):
r
"""Return the current inferred graph."""
if
self
.
self_loops
:
u
=
GraphView
(
self
.
u
,
efilt
=
self
.
eweight
.
fa
>
0
)
else
:
es
=
edge_endpoint_property
(
self
.
u
,
self
.
u
.
vertex_index
,
"source"
)
et
=
edge_endpoint_property
(
self
.
u
,
self
.
u
.
vertex_index
,
"target"
)
u
=
GraphView
(
self
.
u
,
efilt
=
numpy
.
logical_and
(
self
.
eweight
.
fa
>
0
,
es
.
fa
!=
et
.
fa
))
return
u
class
UncertainBlockState
(
UncertainBaseState
):
def
__init__
(
self
,
g
,
q
,
q_default
=
0.
,
phi
=
numpy
.
nan
,
nested
=
True
,
state_args
=
{},
bstate
=
None
,
self_loops
=
False
,
**
kwargs
):
...
...
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