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
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
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?
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,
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