def test_pagerank(property_graph: PropertyGraph): property_name = "NewProp" pagerank(property_graph, property_name) node_schema: Schema = property_graph.node_schema() num_node_properties = len(node_schema) new_property_id = num_node_properties - 1 assert node_schema.names[new_property_id] == property_name pagerank_assert_valid(property_graph, property_name) stats = PagerankStatistics(property_graph, property_name) assert stats.min_rank == approx(0.1499999761581421) assert stats.max_rank == approx(1328.6629638671875, abs=0.06) assert stats.average_rank == approx(0.5205338001251221, abs=0.001)
def run_pagerank(property_graph: PropertyGraph, _input_args): property_name = "NewProp" tolerance = 0.000001 max_iteration = 1000 alpha = 0.85 pagerank_plan = analytics.PagerankPlan.pull_topological(tolerance, max_iteration, alpha) with time_block("pagerank"): analytics.pagerank(property_graph, property_name, pagerank_plan) check_schema(property_graph, property_name) analytics.pagerank_assert_valid(property_graph, property_name) stats = analytics.PagerankStatistics(property_graph, property_name) print(f"STATS:\n{stats}") property_graph.remove_node_property(property_name)