19 #ifndef EXATN_RUNTIME_DAG_HPP_
20 #define EXATN_RUNTIME_DAG_HPP_
22 #include "tensor_graph.hpp"
23 #include "tensor_operation.hpp"
26 #include <boost/graph/adjacency_list.hpp>
27 #include <boost/graph/dag_shortest_paths.hpp>
28 #include <boost/graph/dijkstra_shortest_paths.hpp>
29 #include <boost/graph/eccentricity.hpp>
30 #include <boost/graph/exterior_property.hpp>
31 #include <boost/graph/floyd_warshall_shortest.hpp>
32 #include <boost/graph/graph_traits.hpp>
33 #include <boost/graph/graphviz.hpp>
34 #include <boost/property_map/property_map.hpp>
36 #include <type_traits>
40 using namespace boost;
46 std::shared_ptr<TensorOpNode> properties;
51 boost::property<boost::edge_weight_t, double>>;
53 using DirectedGraphType = std::shared_ptr<d_adj_list>;
55 using d_vertex_type =
typename boost::graph_traits<adjacency_list<
57 boost::property<boost::edge_weight_t, double>>>::vertex_descriptor;
59 using d_edge_type =
typename boost::graph_traits<adjacency_list<
61 boost::property<boost::edge_weight_t, double>>>::edge_descriptor;
63 static_assert(std::is_same<d_vertex_type,VertexIdType>::value,
"Vertex id type mismatch!");
76 VertexIdType addOperation(std::shared_ptr<TensorOperation> op)
override;
78 void addDependency(VertexIdType dependent,
79 VertexIdType dependee)
override;
81 bool dependencyExists(VertexIdType vertex_id1,
82 VertexIdType vertex_id2)
override;
84 TensorOpNode & getNodeProperties(VertexIdType vertex_id)
override;
86 std::size_t getNodeDegree(VertexIdType vertex_id)
override;
88 std::size_t getNumNodes()
override;
90 std::size_t getNumDependencies()
override;
92 std::vector<VertexIdType> getNeighborList(VertexIdType vertex_id)
override;
94 void computeShortestPath(VertexIdType startIndex,
95 std::vector<double> & distances,
96 std::vector<VertexIdType> & paths)
override;
98 void printIt()
override;
100 const std::string name()
const override {
101 return "boost-digraph";
104 const std::string description()
const override {
105 return "Directed acyclic graph of tensor operations";
108 std::shared_ptr<TensorGraph>
clone()
override {
109 return std::make_shared<DirectedBoostGraph>();
113 DirectedGraphType dag_;
119 #endif //EXATN_RUNTIME_DAG_HPP_