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
43
Issues
43
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
58fe4de2
Commit
58fe4de2
authored
Jul 12, 2009
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include min_inter parameter in absolute_trust()
parent
40fb818c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
16 deletions
+24
-16
src/graph/centrality/graph_absolute_trust.cc
src/graph/centrality/graph_absolute_trust.cc
+9
-9
src/graph/centrality/graph_absolute_trust.hh
src/graph/centrality/graph_absolute_trust.hh
+7
-4
src/graph_tool/centrality/__init__.py
src/graph_tool/centrality/__init__.py
+8
-3
No files found.
src/graph/centrality/graph_absolute_trust.cc
View file @
58fe4de2
...
...
@@ -32,8 +32,8 @@ using namespace boost;
using
namespace
graph_tool
;
void
absolute_trust
(
GraphInterface
&
g
,
int64_t
source
,
boost
::
any
c
,
boost
::
any
t
,
double
epslon
,
size_t
m
ax_iter
,
bool
reversed
,
size_t
seed
)
boost
::
any
t
,
double
epslon
,
size_t
m
in_iter
,
size_t
max_iter
,
bool
reversed
,
size_t
seed
)
{
rng_t
rng
(
static_cast
<
rng_t
::
result_type
>
(
seed
));
...
...
@@ -42,13 +42,13 @@ void absolute_trust(GraphInterface& g, int64_t source, boost::any c,
if
(
!
belongs
<
vertex_floating_vector_properties
>
()(
t
))
throw
GraphException
(
"vertex property must be of floating point vector value type"
);
run_action
<>
()
(
g
,
bind
<
void
>
(
get_absolute_trust
()
,
_1
,
g
.
GetVertexIndex
(),
source
,
_2
,
_3
,
epslon
,
max_iter
,
reversed
,
ref
(
rng
)),
edge_floating_properties
(),
vertex_floating_vector_properties
())(
c
,
t
);
run_action
<>
()
(
g
,
bind
<
void
>
(
get_absolute_trust
(),
_1
,
g
.
GetVertexIndex
(),
source
,
_2
,
_3
,
epslon
,
make_pair
(
min_iter
,
max_iter
),
reversed
,
ref
(
rng
)),
edge_floating_properties
(),
vertex_floating_vector_properties
())(
c
,
t
);
}
void
export_absolute_trust
()
...
...
src/graph/centrality/graph_absolute_trust.hh
View file @
58fe4de2
...
...
@@ -39,13 +39,16 @@ struct get_absolute_trust
class
InferredTrustMap
>
void
operator
()(
Graph
&
g
,
VertexIndex
vertex_index
,
int64_t
source
,
TrustMap
c
,
InferredTrustMap
t
,
double
epslon
,
size_t
max_iter
,
bool
reversed
,
rng_t
&
rng
)
const
pair
<
size_t
,
size_t
>
iter_range
,
bool
reversed
,
rng_t
&
rng
)
const
{
typedef
typename
property_traits
<
TrustMap
>::
value_type
c_type
;
typedef
typename
property_traits
<
InferredTrustMap
>::
value_type
::
value_type
t_type
;
size_t
min_iter
=
iter_range
.
first
;
size_t
max_iter
=
iter_range
.
second
;
unchecked_vector_property_map
<
vector
<
t_type
>
,
VertexIndex
>
t_count
(
vertex_index
,
num_vertices
(
g
));
unchecked_vector_property_map
<
vector
<
size_t
>
,
VertexIndex
>
...
...
@@ -76,9 +79,9 @@ struct get_absolute_trust
random_salt
(
0
,
numeric_limits
<
size_t
>::
max
());
size_t
salt
=
random_salt
(
rng
);
t_type
delta
=
2
*
epslon
;
t_type
delta
=
epslon
+
1
;
size_t
iter
=
0
;
while
(
delta
>
=
epslon
||
iter
<
10
)
while
(
delta
>
epslon
||
iter
<
min_iter
)
{
delta
=
0
;
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
...
...
src/graph_tool/centrality/__init__.py
View file @
58fe4de2
...
...
@@ -391,7 +391,8 @@ def eigentrust(g, trust_map, vprop=None, norm=False, epslon=1e-6, max_iter=0,
return
vprop
def
absolute_trust
(
g
,
trust_map
,
source
=
None
,
vprop
=
None
,
epslon
=
0.001
,
max_iter
=
None
,
reversed
=
False
,
seed
=
None
,
ret_iter
=
False
):
min_iter
=
100
,
max_iter
=
None
,
reversed
=
False
,
seed
=
None
,
ret_iter
=
False
):
r
"""
Samples the absolute trust centrality of each vertex in the graph, or only
for a given source, if one is provided.
...
...
@@ -411,8 +412,12 @@ def absolute_trust(g, trust_map, source=None, vprop=None, epslon=0.001,
epslon : float, optional (default: 0.001)
Convergence condition. The iteration will stop if the total delta of all
vertices are below this value.
min_iter : int, optional (default: 100)
If supplied, this will limit the minimal number of iterations (per
source vertex).
max_iter : int, optional (default: None)
If supplied, this will limit the total number of iterations.
If supplied, this will limit the total number of iterations (per
source vertex).
reversed : bool, optional (default: False)
Calculates the "reversed" trust instead: The direction of the edges are
inverted, but the path weighting is preserved in the original direction
...
...
@@ -515,7 +520,7 @@ def absolute_trust(g, trust_map, source=None, vprop=None, epslon=0.001,
ic
=
libgraph_tool_centrality
.
\
get_absolute_trust
(
g
.
_Graph__graph
,
source
,
_prop
(
"e"
,
g
,
trust_map
),
_prop
(
"v"
,
g
,
vprop
),
epslon
,
max_iter
,
reversed
,
seed
)
epslon
,
m
in_iter
,
m
ax_iter
,
reversed
,
seed
)
if
reversed
:
g
.
pop_filter
(
reversed
=
True
)
...
...
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