23 #ifndef GRAPHLAB_DISTRIBUTED_CONSTRAINED_RANDOM_INGRESS_HPP
24 #define GRAPHLAB_DISTRIBUTED_CONSTRAINED_RANDOM_INGRESS_HPP
26 #include <boost/functional/hash.hpp>
28 #include <graphlab/rpc/buffered_exchange.hpp>
29 #include <graphlab/graph/graph_basic_types.hpp>
30 #include <graphlab/graph/ingress/idistributed_ingress.hpp>
31 #include <graphlab/graph/ingress/distributed_ingress_base.hpp>
32 #include <graphlab/graph/distributed_graph.hpp>
33 #include <graphlab/graph/ingress/sharding_constraint.hpp>
34 #include <graphlab/graph/ingress/ingress_edge_decision.hpp>
37 #include <graphlab/macros_def.hpp>
39 template<
typename VertexData,
typename EdgeData>
40 class distributed_graph;
45 template<
typename VertexData,
typename EdgeData>
47 public distributed_ingress_base<VertexData, EdgeData> {
56 typedef distributed_ingress_base<VertexData, EdgeData> base_type;
58 sharding_constraint* constraint;
59 boost::hash<vertex_id_type> hashvid;
63 const std::string& method) :
64 base_type(dc, graph) {
65 constraint =
new sharding_constraint(dc.
numprocs(), method);
74 const EdgeData& edata) {
77 std::vector<procid_t> candidates;
78 constraint->get_joint_neighbors(get_master(source), get_master(target), candidates);
81 base_type::edge_decision.edge_to_proc_random(source, target, candidates);
84 const edge_buffer_record record(source, target, edata);
85 base_type::edge_exchange.send(owning_proc, record);
90 return ingress_edge_decision<VertexData, EdgeData>::mix(vid) % base_type::rpc.numprocs();
94 #include <graphlab/macros_undef.hpp>