• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ edge_type类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中edge_type的典型用法代码示例。如果您正苦于以下问题:C++ edge_type类的具体用法?C++ edge_type怎么用?C++ edge_type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了edge_type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gather

 /** The gather function computes XtX and Xy */
 gather_type gather(icontext_type& context, const vertex_type& vertex, 
                    edge_type& edge) const {
   if(edge.data().role == edge_data::TRAIN) {
     const vertex_type other_vertex = get_other_vertex(edge, vertex);
     return gather_type(other_vertex.data().factor, edge.data().obs);
   } else return gather_type();
 } // end of gather function
开发者ID:carriercomm,项目名称:DPDK-Graph,代码行数:8,代码来源:als_vertex_program.hpp


示例2: scatter

    void scatter(icontext_type& context, const vertex_type& vertex,
                 edge_type& edge) const
    {
        const vertex_type other = edge.target();
        distance_type newd = vertex.data().dist + edge.data().dist;

        const min_distance_type msg(newd);
        context.signal(other, msg);
    }
开发者ID:ddmbr,项目名称:pregelplus-code,代码行数:9,代码来源:SSSP.cpp


示例3: save_edge

 std::string save_edge(const edge_type& edge) const {
   std::stringstream strm;
   const double prediction = 
     edge.source().data().factor.dot(edge.target().data().factor);
   strm << edge.source().id() << '\t' 
        << edge.target().id() << '\t'
        << prediction << '\n';
   return strm.str();
 }
开发者ID:carriercomm,项目名称:DPDK-Graph,代码行数:9,代码来源:als_vertex_program.hpp


示例4: var

    std::string var(const edge_type& v) const {
      assert(v.size() == r);
      std::stringstream s("V");
      typename edge_type::const_iterator i = v.begin();
      s << *(i++) + 1;
      for (; i != v.end(); ++i)
	s << "S" << *i + 1;
      return s.str();
    }
开发者ID:MLewsey,项目名称:oklibrary,代码行数:9,代码来源:Ramsey.hpp


示例5: scatter

  // Scatter to scatter_edges edges with the new message value.
  void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
    bool isEdgeSource = (vertex.id() == edge.source().id());
    bool hasSameData = isEdgeSource ? (vertex.data() == edge.target().data()) : (vertex.data() == edge.source().data()) ;
    if (!hasSameData) {
      min_combiner combiner;
      combiner.value = message_value;

      context.signal(isEdgeSource ? edge.target() : edge.source(), combiner);
    }
  }
开发者ID:3upperm2n,项目名称:PowerGraph,代码行数:11,代码来源:concomp.cpp


示例6: gather

	gather_type gather(icontext_type& context, const vertex_type& vertex, edge_type& edge) const
	{
		cout << "gather(), edge=" << edge.source().id() << "->" << edge.target().id() << ", called from vid=" << vertex.id() << endl;
		
		gather_type gathered;
		
		// add id of other vertex of edge and add id->beta to map if message source
		if (edge.target().id()==vertex.id())
		{
			// incoming edge, outgoing message, only if target is non-observed
			if (!edge.source().data().is_observed)
			{
				gathered.message_targets.insert(edge.source().id());
				cout << "added " << edge.source().id() << " as message target" << endl;
			}
		}
		else
		{
			// outgoing edge, incoming message with beta
			gathered.message_source_betas[edge.target().id()]=edge.data().beta;
			cout << "added " << edge.target().id() << " as message source" << endl;	
		}
					
		cout << "gathered=" << gathered << endl;
		
		return gathered;
	}
开发者ID:karlnapf,项目名称:graphlab,代码行数:27,代码来源:program.hpp


示例7: scatter

	void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {

		EData ed = edge.data();
		float weight = ed.weight;

		if (  !edge.source().data().actived && ((double)rand() / RAND_MAX) < weight){
//		if (  !edge.source().data().actived && 0.5 <= weight){

			context.signal(edge.source());
		}
	}
开发者ID:xiaojingzi,项目名称:saedb,代码行数:11,代码来源:inf_max.hpp


示例8: gather

 gather_type gather(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
     if (context.iteration() == 0) {
         if (vertex.id() == edge.source().id()) {
             return gather_type(edge.target().id());
         } else {
             return gather_type(edge.source().id());
         }
     } else {
         return gather_type();
     }
 }
开发者ID:tudelft-atlarge,项目名称:graphalytics-platforms-powergraph,代码行数:11,代码来源:lcc.cpp


示例9: gather

 factor_type gather(icontext_type& context, const vertex_type& vertex, 
                    edge_type& edge) const {
   vertex_type other_vertex = get_other_vertex(edge, vertex);
   // VIOLATING THE ABSTRACTION!
   vertex_data& vdata = graph_type::vertex_type(vertex).data();
   // VIOLATING THE ABSTRACTION!
   vertex_data& other_vdata = other_vertex.data();
   factor_type& doc_topic_count = 
     is_doc(vertex) ? vdata.factor : other_vdata.factor;
   factor_type& word_topic_count = 
     is_word(vertex) ? vdata.factor : other_vdata.factor;
   ASSERT_EQ(doc_topic_count.size(), NTOPICS);
   ASSERT_EQ(word_topic_count.size(), NTOPICS);
   // run the actual gibbs sampling 
   factor_type& belief = edge.data().belief;
   const uint32_t count = edge.data().count;
   // Resample the topics
   double sum = 0, old_sum = 0;
   for(size_t t = 0; t < NTOPICS; ++t) {
     old_sum += belief[t];
     doc_topic_count[t] -= belief[t];
     word_topic_count[t] -= belief[t];
     GLOBAL_TOPIC_COUNT[t] -= belief[t];
     const double n_dt = 
       std::max(count_type(doc_topic_count[t]), count_type(0));
     ASSERT_GE(n_dt, 0);
     const double n_wt = 
       std::max(count_type(word_topic_count[t]), count_type(0)); 
     ASSERT_GE(n_wt, 0);
     const double n_t  = 
       std::max(count_type(GLOBAL_TOPIC_COUNT[t]), count_type(0)); 
     ASSERT_GE(n_t, 0);
     belief[t] = (ALPHA + n_dt) * (BETA + n_wt) / (BETA * NWORDS + n_t);
     sum += belief[t];
   } // End of loop over each token
   ASSERT_GT(sum, 0);
   if(old_sum == 0) {
     size_t asg = graphlab::random::multinomial(belief);
     for(size_t i = 0; i < NTOPICS; ++i) belief[i] = 0;
     belief[asg] = count;
     return belief;
   }
   for(size_t t = 0; t < NTOPICS; ++t) {
     belief[t] = count * (belief[t]/sum);
     doc_topic_count[t] += belief[t];
     word_topic_count[t] += belief[t];
     GLOBAL_TOPIC_COUNT[t] += belief[t];
   }
   return belief;
 } // end of gather
开发者ID:3upperm2n,项目名称:PowerGraph,代码行数:50,代码来源:fast_cvb0_lda.cpp


示例10: scatter

        void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
            if (context.iteration() == 0) {
                pair<size_t, size_t> p = count_triangles(edge.source(), edge.target());

                if (p.first > 0) {
                    context.signal(edge.source(), p.first);
                }

                if (p.second > 0) {
                    context.signal(edge.target(), p.second);
                }
            } else {
                //
            }
        }
开发者ID:tudelft-atlarge,项目名称:graphalytics-platforms-powergraph,代码行数:15,代码来源:lcc.cpp


示例11: gather

	double gather(icontext_type& context, const vertex_type& vertex,
                 edge_type& edge) const 
	{
		edge_data e = edge.parse<edge_data>();
		int topic = rand()%env_inst.NTOPICS; //sample topic from Mean(1/K)
		e.assignment=topic;
		edge.update<edge_data>(e);
		vertex_data vs=edge.source().parse<vertex_data>();
		vertex_data vt=edge.target().parse<vertex_data>();
		vs.n[topic]++;
		vt.n[topic]++;
		env_inst.nwsum[topic]++;
		env_inst.ndsum[k2id(vs.id)]++;
		return 0;
	}
开发者ID:SkTim,项目名称:saedb,代码行数:15,代码来源:lda.cpp


示例12: scatter

 /**
  * \brief The scatter function just signal adjacent pages
  */
 void scatter(icontext_type& context, const vertex_type& vertex,
              edge_type& edge) const {
     const vertex_type other = get_other_vertex(edge, vertex);
     distance_type newd = vertex.data().dist + edge.data().dist;
     if (other.data().dist > newd) {
         const min_distance_type msg(newd);
         context.signal(other, msg);
     }
 } // end of scatter
开发者ID:YosubShin,项目名称:PowerGraph,代码行数:12,代码来源:sssp.cpp


示例13: gather

    /* Gather the weighted rank of the adjacent page   */
    double gather(icontext_type& context, const vertex_type& vertex,
        edge_type& edge) const {

      if (edge.data().role == edge_data::PREDICT)
         return 0;

      bool brows = vertex.id() < (uint)info.get_start_node(false);
      if (info.is_square()) 
        brows = !mi.A_transpose;
      if (mi.A_offset  && mi.x_offset >= 0){
        double val = edge.data().obs * (brows ? edge.target().data().pvec[mi.x_offset] :
            edge.source().data().pvec[mi.x_offset]);
        //printf("gather edge on vertex %d val %lg obs %lg\n", vertex.id(), val, edge.data().obs);
        return val;
      }
      //printf("edge on vertex %d val %lg\n", vertex.id(), 0.0);
      return 0;
    }
开发者ID:Alienfeel,项目名称:graphlab,代码行数:19,代码来源:math.hpp


示例14: scatter

    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);

    }
开发者ID:pkuwalter,项目名称:evaluation,代码行数:9,代码来源:PageRank.cpp


示例15: scatter

  /**
   * \brief The scatter function just signal adjacent pages 
   */
  void scatter(icontext_type& context, const vertex_type& vertex,
               edge_type& edge) const {
    const vertex_type other = edge.target();
    /*if (USE_DELTA_CACHE) {
    	gather_data_type delta;
    	delta.dist = lastchange;
    	context.post_delta(other, delta);
    }*/

    context.signal(other);
  }
开发者ID:HybridGraph,项目名称:GraphLab-PowerGraph,代码行数:14,代码来源:sssp.cpp


示例16: scatter

	void scatter(icontext_type& context, const vertex_type& vertex,
			edge_type& edge) const {
		context.signal(edge.target());
	}
开发者ID:neozhangthe1,项目名称:saedb,代码行数:4,代码来源:pagerank.cpp


示例17: scatter

 void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
     const vertex_type& other = edge.source().id() == vertex.id() ? edge.target() : edge.source();
     context.signal(other);
 }
开发者ID:tudelft-atlarge,项目名称:graphalytics-platforms-powergraph,代码行数:4,代码来源:cd.cpp


示例18: scatter

 void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
     float weight = edge.data();
     if ( ((double)rand() / RAND_MAX) < weight){
         context.signalVid(edge.target().id());
     }
 }
开发者ID:HongleiZhuang,项目名称:saedb,代码行数:6,代码来源:inf_max.cpp


示例19: scatter

	void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const
	{
		if (vertex.data() + edge.data() < edge.target().data())
			context.signal(edge.target());
	}
开发者ID:HongleiZhuang,项目名称:saedb,代码行数:5,代码来源:shortest_path.cpp


示例20: gather

	gather_type gather(icontext_type& context, const vertex_type& vertex, edge_type& edge) const
	{
		float newval = edge.data() + edge.source().data();
		return gather_type(newval);
	}
开发者ID:HongleiZhuang,项目名称:saedb,代码行数:5,代码来源:shortest_path.cpp



注:本文中的edge_type类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ editor_display类代码示例发布时间:2022-05-31
下一篇:
C++ edge类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap