On 07/28/2011 06:16 AM, tamo wrote:
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
% 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,
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)