elaboration please: remove_vertex_if&find_vertex

Hi,

Thank you again for this great library.

First, could you please describe more details about using remove_vertex_if
and find_vertex?
and how to deal with the returned of those functions?

also, I have a simulation scenario where I have to remove nodes with the 10
% highest degrees. thus, I tried to use the following code as initial
attempt

*prop = gt.find_vertex(g,"total",6)
gv = gt.GraphView(g, vfilt=prop, efilt=None, directed=False, reversed=False)

First, could you please describe more details about using remove_vertex_if
and find_vertex?
and how to deal with the returned of those functions?

The function find_vertex() returns a list of vertices which match the
given property. The function remove_vertex_if() takes a _function_ as a
parameter. This function is called for each vertex in the graph. If the
returned value is 'True' for a given vertex, it is removed.

also, I have a simulation scenario where I have to remove nodes with

the 10

% highest degrees. thus, I tried to use the following code as initial
attempt

*prop = gt.find_vertex(g,"total",6)
gv = gt.GraphView(g, vfilt=prop, efilt=None, directed=False,

reversed=False)

*

In this code, 'prop' is not a property map, it is a list of
vertices. The 'vfilt' parameter expects either a property map or a
function.

If you want to filter out all vertices which have an out-degree larger
than 6, yo can do something like:

   gv = gt.GraphView(g, vfilt=lambda v: v.out_degree() <= 6)

Cheers,
Tiago

Hi,

I'm trying to use centrality functions but I have a problem with
trust_transitivity function.
I'm loading my own graph using g = load_graph("graph1.dot") inisted of
gt.random_graph(100, lambda: (poisson(3), poisson(3))).

however, the returned of

t = gt.trust_transitivity(g, trust, source=g.vertex(2))
print t.a

[ 0. 0. 1. ..., 0. 0. 0.]

and the returned of

t = gt.trust_transitivity(g, trust, *source=None, target=None*)
print t.a

None

seems that deg_sampler of random_graph function (i.e., lambda: (poisson(3),
poisson(3)) ) is required to my loaded graph
how do I solve this and let the trust_transitivity function works with the
loaded graph?

Best regards,
Tamo

Everything is working as it is supposed to. The difference is that if
you pass source=None and target=None, the trust value between _all pair_
of vertices is returned. This means that the value type of the property
map is a _vector_ instead of a scalar, so it cannot be accessed by the
".a" attribute. You have to use vertex descriptors,

     v = g.vertex(10)
     print t[v]

Cheers,
Tiago

http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/file/n3253736/Graph1.dot
Graph1.dot

thanks for the quick reply.

I have this simple code to use the function

g = load_graph("Graph1.dot")
trust = g.new_edge_property("double")
trust.a = random(g.num_edges())
t = gt.trust_transitivity(g, trust, source=g.vertex(2), target=None)
print t.a

I was expecting to get some values same as the documentation example, so
could you please explain to me why do I got the following results?
[ 0. 0. 1. ..., 0. 0. 0.]

Thank you

P.S attached file is the graph I used to run this code

Why do you expect to get the same values as in the documentation for a
different graph?

I checked your graph, and it is undirected. Trust transitivity is only
properly defined for directed graphs.

Cheers,
Tiago