6 #ifndef TURI_SGRAPH_SGRAPH_FAST_TRIPLE_APPLY 7 #define TURI_SGRAPH_SGRAPH_FAST_TRIPLE_APPLY 9 #include<core/data/flexible_type/flexible_type.hpp> 10 #include<core/storage/sgraph_data/sgraph.hpp> 11 #include<core/storage/sgraph_data/sgraph_compute_vertex_block.hpp> 25 namespace sgraph_compute {
28 struct vertex_address {
33 typedef std::vector<flexible_type> edge_data;
43 edge_data&
edge() {
return *m_edge; }
45 const edge_data& edge()
const {
return *m_edge; }
47 vertex_address source_vertex_address() {
return m_source_addr; }
49 vertex_address target_vertex_address() {
return m_target_addr; }
53 const vertex_address& target_addr,
55 m_source_addr(source_addr), m_target_addr(target_addr), m_edge(edge) { }
58 vertex_address m_source_addr;
59 vertex_address m_target_addr;
63 typedef std::function<void(fast_edge_scope&)> fast_triple_apply_fn_type;
87 fast_triple_apply_fn_type apply_fn,
88 const std::vector<std::string>& edge_fields,
89 const std::vector<std::string>& mutated_edge_fields);
105 std::vector<std::vector<T>> create_vertex_data_from_const(
const sgraph& g,
const T& init) {
fast_edge_scope(const vertex_address &source_addr, const vertex_address &target_addr, edge_data *edge)
Do not construct edge_scope directly. Used by triple_apply_impl.
size_t get_num_partitions() const
edge_data & edge()
Provide edge data access.
void fast_triple_apply(sgraph &g, fast_triple_apply_fn_type apply_fn, const std::vector< std::string > &edge_fields, const std::vector< std::string > &mutated_edge_fields)
std::vector< std::vector< T > > create_vertex_data(const sgraph &g)
sframe & vertex_partition(size_t partition, size_t groupid=0)