dyng
DynamicGraphLayout
partitions.h
1 /*
2  Copyright 2020 František Bráblík
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 #pragma once
17 
18 #include "node.h"
19 #include "edge.h"
20 #include "live_set.h"
21 
22 namespace dyng {
23 
24 namespace detail {
25 
27 
33 class node_partition : public node {
34 public:
36  : node(id) {}
37 
38  void add_live_time(const live_set& node_live) {
39  m_live_time.join(node_live);
40  }
41 
42  const live_set& live_time() const { return m_live_time; }
43  live_set& live_time() { return m_live_time; }
44 
45 private:
46  live_set m_live_time;
47 };
48 
50 
56 class edge_partition : public basic_edge<node_partition> {
57 public:
59  : basic_edge(id, one, two) {}
60 
61  void add_live_time(const live_set& edge_live) {
62  m_live_time.join(edge_live);
63  }
64 
65  const live_set& live_time() const { return m_live_time; }
66  live_set& live_time() { return m_live_time; }
67 
68 private:
69  live_set m_live_time;
70 };
71 
72 } // namespace detail
73 
74 } // namespace dyng
dyng::edge_id
Type used as an identifier for edges.
Definition: identifiers.h:87
dyng::detail::edge_partition
Represents an edge that holds information about its live times.
Definition: partitions.h:56
dyng::detail::node_partition
Represents a node that holds information about its live times.
Definition: partitions.h:33
dyng::basic_edge< node_partition >::basic_edge
basic_edge(edge_id id, node_id one, node_id two)
Sets the id of the edge and ids of two connected nodes.
Definition: edge.h:44
dyng::node
Definition: node.h:32
dyng::detail::live_set
Represents a set of all states where a node or an edge exists.
Definition: live_set.h:30
dyng::node_id
Type used as an identifier for nodes.
Definition: identifiers.h:77
dyng::node::node
node(node_id id)
Sets the id of the node.
Definition: node.h:35
dyng::basic_edge
Definition: edge.h:41