logo

MODELS AND ALGORITHMS FOR PAGERANK SENSITIVITY

PDF Publication Title:

MODELS AND ALGORITHMS FOR PAGERANK SENSITIVITY ( models-and-algorithms-for-pagerank-sensitivity )

Previous Page View | Next Page View | Return to Search List

Text from PDF Page: 147

The corresponding MatlabBGL function takes only one argument, the vertex index. Here, we illustrate this visitor type by example as Matlab does not have function prototypes: visitor.examine_vertex = @(u) fprintf(’called examine_vertex(%i)!\n’, u); In MatlabBGL, the other vertex visitors follow this same pattern: the only argument is the index of the vertex. Edge visitors in Boost provide a BGL edge type: void visitor::examine_edge(Edge e, Graph& g) MatlabBGL translates the edge type into an edge index, a source vertex, and a target vertex, which are provided to the visitor function (again illustrated with an example visitor): visitor.examine_edge = @(ei,u,v) fprintf(’called examine_edge(%i,%i)!\n’, u); A considerable issue with visitors is that they call back to Matlab from a mex file. This operation is not efficient and visitors are not appropriate for large-scale computations. Nevertheless, they are an important part of the Boost graph library and belong in MatlabBGL. We end this section with two examples that show how visitors are used in the library. watching an algorithm with a visitor In this example, we write a simple visitor that outputs an algorithm’s behavior. The algorithm we examine is dijkstra_sp. To examine the runtime behavior we use a visitor that outputs a string every time a function is called. The dijkstra_sp function supports the following visitors: • initialize_vertex(u) • discover_vertex(u) • examine_vertex(u) • examine_edge(ei,u,v) • edge_relaxed(ei,u,v) • edge_not_relaxed(ei,u,v) • finish_vertex(u) Rather than implementing 7 functions ourselves, we define two helper func- tions. There is one helper that returns a vertex visitor and one helper than returns an edge visitor: vertex_vis_print_func = @(str) @(u) ... fprintf(’%s called on %s\n’, str, char(labels{u})); edge_vis_print_func = @(str) @(ei,u,v) ... fprintf(’%s called on (%s,%s)\n’, str, char(labels{u}), char(labels{v})); We are almost done. We just have to setup the visitor structure to pass to the dijkstra_sp call: vis = struct(); vis.initialize_vertex = vertex_vis_print_func(’initialize_vertex’); vis.discover_vertex = vertex_vis_print_func(’discover_vertex’); vis.examine_vertex = vertex_vis_print_func(’examine_vertex’); vis.finish_vertex = vertex_vis_print_func(’finish_vertex’); vis.examine_edge = edge_vis_print_func(’examine_edge’); vis.edge_relaxed = edge_vis_print_func(’edge_relaxed’); vis.edge_not_relaxed = edge_vis_print_func(’edge_not_relaxed’); 6.3 ⋅ matlabbgl 127

PDF Image | MODELS AND ALGORITHMS FOR PAGERANK SENSITIVITY

models-and-algorithms-for-pagerank-sensitivity-147

PDF Search Title:

MODELS AND ALGORITHMS FOR PAGERANK SENSITIVITY

Original File Name Searched:

gleich-pagerank-thesis.pdf

DIY PDF Search: Google It | Yahoo | Bing

Cruise Ship Reviews | Luxury Resort | Jet | Yacht | and Travel Tech More Info

Cruising Review Topics and Articles More Info

Software based on Filemaker for the travel industry More Info

The Burgenstock Resort: Reviews on CruisingReview website... More Info

Resort Reviews: World Class resorts... More Info

The Riffelalp Resort: Reviews on CruisingReview website... More Info

CONTACT TEL: 608-238-6001 Email: greg@cruisingreview.com | RSS | AMP