3#include <boost/function.hpp>
4#include <boost/graph/adjacency_list.hpp>
5#include <boost/graph/breadth_first_search.hpp>
6#include <boost/graph/depth_first_search.hpp>
7#include <boost/graph/graph_traits.hpp>
8#include <boost/graph/graphviz.hpp>
9#include <boost/graph/labeled_graph.hpp>
10#include <boost/graph/properties.hpp>
11#include <boost/property_map/property_map.hpp>
12#include <boost/thread.hpp>
34 boost::property<boost::vertex_index_t, blk_hash_t, boost::property<boost::vertex_index1_t, uint64_t>>;
39 boost::adjacency_list<boost::setS, boost::hash_setS, boost::directedS, vertex_property_t, edge_property_t>;
40 using graph_t = boost::labeled_graph<adj_list_t, blk_hash_t, boost::hash_mapS>;
41 using vertex_t = boost::graph_traits<graph_t>::vertex_descriptor;
42 using edge_t = boost::graph_traits<graph_t>::edge_descriptor;
44 using edge_iter_t = boost::graph_traits<graph_t>::edge_iterator;
72 void getLeaves(std::vector<blk_hash_t> &tips)
const;
73 void drawGraph(std::string
const &filename)
const;
76 const std::map<uint64_t, std::unordered_set<blk_hash_t>> &non_finalized_blks);
119template <
class Property1>
123 template <
class Vertex>
125 out <<
"[label=\"" <<
name[v].toString().substr(0, 8) <<
" " <<
"\"]";
132template <
class Property>
136 template <
class Edge>
139 out <<
"[style=\"dashed\" dir=\"back\"]";
141 out <<
"[dir=\"back\"]";
Definition key_manager.hpp:11
boost::property< boost::vertex_index_t, blk_hash_t, boost::property< boost::vertex_index1_t, uint64_t > > vertex_property_t
Definition dag.hpp:34
virtual ~PivotTree()=default
graph_t graph_
Definition dag.hpp:88
edge_label_writer(Property weight)
Definition dag.hpp:135
boost::property_map< graph_t, boost::vertex_index_t >::const_type vertex_index_map_const_t
Definition dag.hpp:48
boost::property< boost::edge_index_t, uint64_t > edge_property_t
Definition dag.hpp:35
boost::graph_traits< graph_t >::adjacency_iterator vertex_adj_iter_t
Definition dag.hpp:45
boost::property_map< graph_t, boost::vertex_index1_t >::type vertex_period_map_t
Definition dag.hpp:52
void collectLeafVertices(std::vector< vertex_t > &leaves) const
Definition dag.cpp:89
bool reachable(vertex_t const &from, vertex_t const &to) const
Definition dag.cpp:173
void getLeaves(std::vector< blk_hash_t > &tips) const
Definition dag.cpp:29
boost::property_map< graph_t, boost::edge_index_t >::const_type edge_index_map_const_t
Definition dag.hpp:54
bool hasVertex(blk_hash_t const &v) const
Definition dag.cpp:27
std::vector< blk_hash_t > getGhostPath(const blk_hash_t &vertex) const
Definition dag.cpp:204
friend DagManager
Definition dag.hpp:57
uint64_t getNumEdges() const
Definition dag.cpp:25
bool addVEEs(blk_hash_t const &new_vertex, blk_hash_t const &pivot, std::vector< blk_hash_t > const &tips)
Definition dag.cpp:37
boost::property_map< graph_t, boost::vertex_index_t >::type vertex_index_map_t
Definition dag.hpp:49
boost::graph_traits< graph_t >::edge_iterator edge_iter_t
Definition dag.hpp:44
PivotTree(blk_hash_t const &dag_genesis_block_hash)
Definition dag.hpp:102
vertex_label_writer(Property1 name)
Definition dag.hpp:122
bool computeOrder(const blk_hash_t &anchor, std::vector< blk_hash_t > &ordered_period_vertices, const std::map< uint64_t, std::unordered_set< blk_hash_t > > &non_finalized_blks)
Definition dag.cpp:103
boost::labeled_graph< adj_list_t, blk_hash_t, boost::hash_mapS > graph_t
Definition dag.hpp:40
boost::graph_traits< graph_t >::vertex_iterator vertex_iter_t
Definition dag.hpp:43
boost::property_map< graph_t, boost::vertex_index1_t >::const_type vertex_period_map_const_t
Definition dag.hpp:51
PivotTree(const PivotTree &)=default
Dag & operator=(Dag &&)=default
void drawGraph(std::string const &filename) const
Definition dag.cpp:77
void operator()(std::ostream &out, const Vertex &v) const
Definition dag.hpp:124
logger::Logger logger_
Definition dag.hpp:91
boost::graph_traits< graph_t >::edge_descriptor edge_t
Definition dag.hpp:42
Property1 name
Definition dag.hpp:129
boost::property_map< graph_t, boost::edge_index_t >::type edge_index_map_t
Definition dag.hpp:55
Property weight
Definition dag.hpp:146
Dag & operator=(const Dag &)=default
friend DagManager
Definition dag.hpp:101
boost::adjacency_list< boost::setS, boost::hash_setS, boost::directedS, vertex_property_t, edge_property_t > adj_list_t
Definition dag.hpp:39
PivotTree(PivotTree &&)=default
boost::graph_traits< graph_t >::vertex_descriptor vertex_t
Definition dag.hpp:41
void clear()
Definition dag.cpp:87
uint64_t getNumVertices() const
Definition dag.cpp:24
PivotTree & operator=(const PivotTree &)=default
void operator()(std::ostream &out, const Edge &e) const
Definition dag.hpp:137
PivotTree & operator=(PivotTree &&)=default
Thread safe. Labelled graph.
Definition dag.hpp:30
std::shared_ptr< spdlog::logger > Logger
Definition logging.hpp:12