Chi-Tech
chi_directed_graph_vertex.h
Go to the documentation of this file.
1#ifndef CHI_DIRECTED_GRAPH_VERTEX_H
2#define CHI_DIRECTED_GRAPH_VERTEX_H
3
4#include "chi_graph.h"
5
6#include <map>
7
8//###################################################################
9/**General implementation of a directed-graph vertex.*/
11{
12 size_t id;
13 void* context;
14
15 std::set<size_t> us_edge;
16 std::set<size_t> ds_edge;
17
18 std::map<size_t,double> us_weights;
19 std::map<size_t,double> ds_weights;
20
21 GraphVertex(size_t in_id, void* in_context) :
22 id(in_id),
23 context(in_context)
24 {}
25
26 explicit GraphVertex(size_t in_id) :
27 id(in_id),
28 context(nullptr)
29 {}
30
32 {
33 this->id = in_v.id;
34 this->context = in_v.context;
35
36 us_edge = in_v.us_edge;
37 ds_edge = in_v.ds_edge;
38 }
39
40 GraphVertex(GraphVertex&& in_v) noexcept
41 {
42 this->id = in_v.id;
43 this->context = in_v.context;
44
45 us_edge = in_v.us_edge;
46 ds_edge = in_v.ds_edge;
47
48 in_v.context = nullptr;
49 }
50
52 {
53 if (this == &in_v) return *this;
54
55 this->id = in_v.id;
56 this->context = in_v.context;
57
58 us_edge = in_v.us_edge;
59 ds_edge = in_v.ds_edge;
60
61 return *this;
62 }
63
65 {
66 this->id = in_v.id;
67 this->context = in_v.context;
68
69 us_edge = in_v.us_edge;
70 ds_edge = in_v.ds_edge;
71
72 in_v.context = nullptr;
73
74 return *this;
75 }
76
77 bool operator==(const GraphVertex& other) const
78 {
79 return other.id == this->id;
80 }
81};
82
83#endif //CHI_DIRECTED_GRAPH_VERTEX_H
GraphVertex & operator=(GraphVertex &&in_v) noexcept
std::set< size_t > ds_edge
GraphVertex(size_t in_id, void *in_context)
bool operator==(const GraphVertex &other) const
GraphVertex & operator=(const GraphVertex &in_v)
GraphVertex(const GraphVertex &in_v)
GraphVertex(GraphVertex &&in_v) noexcept
std::map< size_t, double > ds_weights
std::set< size_t > us_edge
std::map< size_t, double > us_weights