示例#1
0
    void scatter(icontext_type& context, const vertex_type& vertex,
            edge_type& edge) const {
        const vertex_type other = edge.target();
        pagerank_type value = vertex.data().pagerank / vertex.num_out_edges();
        assert(other.id() != vertex.id());
        const sum_pagerank_type msg(value);
        context.signal(other, msg);

    }
示例#2
0
 void apply(icontext_type& context, vertex_type& vertex,
            const factor_type& sum) {
   const size_t num_neighbors = vertex.num_in_edges() + vertex.num_out_edges();
   ASSERT_GT(num_neighbors, 0);
   // There should be no new edge data since the vertex program has been cleared
   vertex_data& vdata = vertex.data();
   ASSERT_EQ(sum.size(), NTOPICS);
   ASSERT_EQ(vdata.factor.size(), NTOPICS);
   vdata.nupdates++; vdata.nchanges = 0; 
   vdata.factor = sum;
 } // end of apply
示例#3
0
文件: enron.cpp 项目: hanwentao/saedb
	void apply(icontext_type& context, vertex_type& vertex,
               const gather_type& total)
    	{
		sort_pool.push_back(make_pair(vertex.parse<vertex_data>().id,vertex.num_in_edges()+vertex.num_out_edges()));
		
	}
 void apply(icontext_type& context, vertex_type& vertex,
            const gather_type& total) {
   ASSERT_EQ( total, int(vertex.num_out_edges()) );
 }
 void apply(icontext_type& context, vertex_type& vertex,
            const gather_type& total) {
   graphlab::timer::sleep_ms(100);
   ASSERT_EQ( total, int(vertex.num_in_edges() + vertex.num_out_edges() ) );
 }
 /**
  * \brief Signal all vertices on one side of the bipartite graph
  */
 static graphlab::empty signal_left(icontext_type& context,
                                    vertex_type& vertex) {
   if(vertex.num_out_edges() > 0) context.signal(vertex);
   return graphlab::empty();
 } // end of signal_left