jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
graph.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2011,2012 Preferred Networks and Nippon Telegraph and Telephone Corporation.
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License version 2.1 as published by the Free Software Foundation.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #ifndef JUBATUS_CORE_DRIVER_GRAPH_HPP_
18 #define JUBATUS_CORE_DRIVER_GRAPH_HPP_
19 
20 #include <string>
21 #include <utility>
22 #include <vector>
23 #include "jubatus/util/lang/shared_ptr.h"
24 #include "../graph/graph_wo_index.hpp"
25 #include "../graph/graph_type.hpp"
26 #include "../framework/mixable.hpp"
27 #include "driver.hpp"
28 
29 namespace jubatus {
30 namespace core {
31 namespace driver {
32 
33 class graph : public driver_base {
34  public:
35  explicit graph(
36  jubatus::util::lang::shared_ptr<core::graph::graph_wo_index>
37  graph_method);
38  virtual ~graph();
39 
41  return graph_.get();
42  }
43 
45  void update_node(
49  void create_edge(
54  void update_edge(
58  double get_centrality(
61  const jubatus::core::graph::preset_query& q) const;
62  std::vector<jubatus::core::graph::node_id_t> get_shortest_path(
65  uint64_t max_hop,
66  const jubatus::core::graph::preset_query &q) const;
75  void update_index();
76  void clear();
77  void pack(framework::packer& pk) const;
78  void unpack(msgpack::object o);
79 
80  // internal apis used between servers
83  void create_edge_here(
88 
89  private:
90  jubatus::util::lang::shared_ptr<core::graph::graph_wo_index> graph_;
92 };
93 
94 } // namespace driver
95 } // namespace core
96 } // namespace jubatus
97 
98 #endif // JUBATUS_CORE_DRIVER_GRAPH_HPP_
graph(jubatus::util::lang::shared_ptr< core::graph::graph_wo_index > graph_method)
Definition: graph.cpp:42
void remove_global_node(jubatus::core::graph::node_id_t nid)
Definition: graph.cpp:145
jubatus::util::lang::shared_ptr< core::graph::graph_wo_index > graph_
Definition: graph.hpp:90
void update_edge(jubatus::core::graph::edge_id_t eid, const jubatus::core::graph::property &p)
Definition: graph.cpp:73
jubatus::core::graph::edge_info get_edge(jubatus::core::graph::edge_id_t eid) const
Definition: graph.cpp:120
void create_edge(jubatus::core::graph::edge_id_t eid, jubatus::core::graph::node_id_t src, jubatus::core::graph::node_id_t target, const jubatus::core::graph::property &p)
Definition: graph.cpp:64
void remove_node(jubatus::core::graph::node_id_t id)
Definition: graph.cpp:59
void remove_edge(jubatus::core::graph::edge_id_t eid)
Definition: graph.cpp:77
void update_node(jubatus::core::graph::node_id_t id, const jubatus::core::graph::property &p)
Definition: graph.cpp:55
void create_node(jubatus::core::graph::node_id_t id)
Definition: graph.cpp:51
std::map< std::string, std::string > property
Definition: graph_type.hpp:39
void create_node_here(jubatus::core::graph::node_id_t id)
Definition: graph.cpp:134
jubatus::core::graph::node_info get_node(jubatus::core::graph::node_id_t nid) const
Definition: graph.cpp:114
jubatus::core::graph::graph_wo_index * get_model() const
Definition: graph.hpp:40
void pack(framework::packer &pk) const
Definition: graph.cpp:168
std::vector< jubatus::core::graph::node_id_t > get_shortest_path(jubatus::core::graph::node_id_t src, jubatus::core::graph::node_id_t target, uint64_t max_hop, const jubatus::core::graph::preset_query &q) const
Definition: graph.cpp:88
jubatus::core::graph::mixable_graph_wo_index mixable_
Definition: graph.hpp:91
void unpack(msgpack::object o)
Definition: graph.cpp:172
void add_shortest_path_query(const jubatus::core::graph::preset_query &q)
Definition: graph.cpp:102
void create_edge_here(jubatus::core::graph::edge_id_t eid, jubatus::core::graph::node_id_t src, jubatus::core::graph::node_id_t target, const jubatus::core::graph::property &p)
Definition: graph.cpp:155
void add_centrality_query(const jubatus::core::graph::preset_query &q)
Definition: graph.cpp:98
double get_centrality(jubatus::core::graph::node_id_t nid, jubatus::core::graph::centrality_type ct, const jubatus::core::graph::preset_query &q) const
Definition: graph.cpp:81
void remove_centrality_query(const jubatus::core::graph::preset_query &q)
Definition: graph.cpp:106
void remove_shortest_path_query(const jubatus::core::graph::preset_query &q)
Definition: graph.cpp:110