本文整理汇总了C++中icontext_type::signal方法的典型用法代码示例。如果您正苦于以下问题:C++ icontext_type::signal方法的具体用法?C++ icontext_type::signal怎么用?C++ icontext_type::signal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类icontext_type
的用法示例。
在下文中一共展示了icontext_type::signal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 {
//
}
}
示例2: 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
示例3: 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);
}
示例4: 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);
}
示例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);
}
}
示例6: 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);
}
示例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());
}
}
示例8: apply
void apply(icontext_type& context, vertex_type& vertex,
const graphlab::empty& empty) {
if (context.iteration() < ROUND)
{
context.signal(vertex);
}
if(context.iteration() == 0)
{
return;
}
pagerank_type new_pagerank = 0.15 + 0.85 * sum_pagerank;
vertex.data().pagerank = new_pagerank;
}
示例9: 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());
}
示例10: scatter
void scatter(icontext_type& context, const vertex_type& vertex,
edge_type& edge) const {
const vertex_type other_vertex = get_other_vertex(edge, vertex);
context.signal(other_vertex);
} // end of scatter function
示例11: scatter
//.........这里部分代码省略.........
// R_{s}^{-1}(Q_{s}^{T}((P_{s}(W_{s}W_{t}^{T}))(R_{t}^{-1}(Q_{t}^{T}(P_{t}k_{\mathcal{I}_{t}}^{(s)})))
new_beta=k;
new_beta=P_t.transpose()*new_beta;
new_beta=Q_t.transpose()*new_beta;
new_beta=R_t.triangularView<Upper>().solve(new_beta);
new_beta=W*new_beta;
new_beta=P_s.transpose()*new_beta;
new_beta=Q_s.transpose()*new_beta;
new_beta=R_s.triangularView<Upper>().solve(new_beta);
}
}
else
{
cout << "non-observed target" << endl;
cout << "multiplied_incoming_messages: " << vertex.data().multiplied_incoming_messages << endl;
// extract system solutions, depending on full rank or incomplete Cholesky
if (edge.data().full_rank)
{
cout << "full rank case" << endl;
MatrixXd L_s=edge.data().solution_matrices["L_s"];
cout << "L_s:" << L_s << endl;
VectorXd k;
if (!vertex.data().multiplied_incoming_messages.size())
{
cout << "no incoming messages, using constant unit norm vector" << endl;
k=VectorXd::Constant(L_s.cols(), 1.0/sqrt(L_s.cols()));
}
else
{
k=vertex.data().multiplied_incoming_messages.at(message_target);
}
cout << "k:" << k << endl;
// (K_{s}+\lambda I){}^{-1}k_{ut}^{(s)}=L_{s}^{-T}(L_{s}^{-1}k_{ut}^{(s)}) from right to left, 2 solver calls
new_beta=k;
new_beta=L_s.triangularView<Lower>().solve(new_beta);
new_beta=L_s.transpose().triangularView<Upper>().solve(new_beta);
}
else
{
cout << "incomplete Cholesky case" << endl;
MatrixXd Q_s=edge.data().solution_matrices["Q_s"];
cout << "Q_s:" << Q_s << endl;
MatrixXd R_s=edge.data().solution_matrices["R_s"];
cout << "R_s:" << R_s << endl;
MatrixXd P_s=edge.data().solution_matrices["P_s"];
cout << "P_s:" << P_s << endl;
MatrixXd W=edge.data().solution_matrices["W"];
cout << "W:" << W << endl;
VectorXd k;
if (!vertex.data().multiplied_incoming_messages.size())
{
cout << "no incoming messages, using constant unit norm vector" << endl;
k=VectorXd::Constant(W.cols(), 1.0/sqrt(W.cols()));
}
else
{
k=vertex.data().multiplied_incoming_messages.at(message_target);
}
cout << "k:" << k << endl;
// R_{s}^{-1}(Q_{s}^{T}(P_{s}^{T}k_{t}^{(s)}))
new_beta=k;
new_beta=W*new_beta;
new_beta=P_s.transpose()*new_beta;
new_beta=Q_s.transpose()*new_beta;
new_beta=R_s.triangularView<Upper>().solve(new_beta);
}
}
// normalise
new_beta=new_beta/new_beta.norm();
// check whether has changed or not yet existed
double difference;
if (!edge.data().beta.rows())
difference=numeric_limits<double>::infinity();
else
difference=(new_beta-edge.data().beta).norm();
cout << "beta norm difference is " << difference << endl;
if (difference>BETA_EPSILON)
{
// store new message and signal depending node if beta has changed or has not yet existed
edge.data().beta=new_beta;
context.signal(edge.source());
cout << "beta has changed, new_beta=" << new_beta << "\nhas norm=" << new_beta.norm() << ", signalling vid=" << edge.source().id() << endl;
}
else
{
cout << "converged!\n";
}
cout << "beta: " << edge.source().id() << "->" << edge.target().id() << ": " << edge.data().beta << endl;
}
示例12: scatter
void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
if( edge.target().data().in_core ) {
context.signal(edge.target());
}
}
示例13: scatter
void scatter(icontext_type& context, const vertex_type& vertex,
edge_type& edge) const {
context.signal(edge.target());
}
示例14: 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();
context.signal(other);
}
示例15: empty
/**
* \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