All Distance Sketch  0.1
All distance sketch based algorithms
generic_graph_adaptor.h
1 #ifndef ALL_DISTANCE_SKETCH_ALL_DISTANCE_SKETCH_GRAPH_GENERIC_GRAPH_ADAPTOR_H_
2 #define ALL_DISTANCE_SKETCH_ALL_DISTANCE_SKETCH_GRAPH_GENERIC_GRAPH_ADAPTOR_H_
3 
4 #include "graph.h"
5 
6 namespace all_distance_sketch {
7 namespace graph {
8 
9 class GenericGraphAdaptor {
10  public:
11  class GenericIterator {
12  public:
13  int GetId() { return 0; }
14 
15  int GetDeg() { return -1; }
16 
17  int GetNbrNId(int n) { return -1; }
18 
19  int GetOutDeg() const { return -1; }
20 
21  bool HasMore() const { return false; }
22 
23  int GetOutNId(int n) const { return -1; }
24 
25  GenericIterator& operator++(int) { return *this; }
26 
27  inline bool operator==(const GenericIterator& rhs) { return false; }
28 
29  inline bool operator!=(const GenericIterator& rhs) { return false; }
30  };
31 
32  class GenericNode {
33  public:
34  GenericNode(int dummy) {}
35  int GetId() { return -1; }
36  };
37 
38  typedef GenericNode TNode;
39  typedef GenericIterator TNodeI;
40 
41  int AddNode(int aNid = -1) { return -1; }
42 
43  int AddEdge(const int& aSrcNId, const int& aDstNId, int aWeight = 1) {
44  return -1;
45  }
46 
47  TNodeI BegNI() {
48  TNodeI iteratorDummy;
49  return iteratorDummy;
50  }
51 
52  TNodeI EndNI() {
53  TNodeI iteratorDummy;
54  return iteratorDummy;
55  }
56 
57  bool IsEdge(const int& aSrcNId, const int& aDstNId) const {
58  return false;
59  }
60 
61  bool IsNode(const int& NId) const {
62  return false;
63  }
64 
65  int GetNodes() const { return 0; }
66 
67  int GetEdges() const { return 0; }
68 
69  TNodeI GetNI(const int& aNId) const {
70  TNodeI iteratorDummy;
71  return iteratorDummy;
72  }
73 
74  int GetMxNId() const { return 0; }
75 };
76 
77 typedef GenericGraphAdaptor TUnDirectedGraph;
78 typedef GenericGraphAdaptor TDirectedGraph;
79 
80 template<>
81 struct GraphTrait< TUnDirectedGraph > {
82  static const bool directed = false;
83 };
84 
85 /*
86 template<>
87 struct GraphTrait< TDirectedGraph > {
88  static const bool directed = true;
89 };
90 */
91 
92 } // namespace graph
93 } // namespace all_distance_sketch
94 
95 #endif // ALL_DISTANCE_SKETCH_ALL_DISTANCE_SKETCH_GRAPH_GENERIC_GRAPH_ADAPTOR_H_
Definition: common.h:53
Graph class.