1 #ifndef GRAPH_ANALYSIS_IO_GVGRAPH_HPP 2 #define GRAPH_ANALYSIS_IO_GVGRAPH_HPP 7 #include <graphviz/cgraph.h> 9 #include <graphviz/gvc.h> 10 #include "../BaseGraph.hpp" 18 static inline Agraph_t* _agopen(
const std::string& name, Agdesc_t kind)
25 #ifdef GRAPHVIZ_DEPRECATED 26 #warning "You are using a graphviz version < 2.36.0 -- limited support only" 27 return agopen(const_cast<char*>(name.c_str()), kind);
29 return agopen(const_cast<char*>(name.c_str()), kind, 0);
33 static inline Agnode_t* _agnode(Agraph_t* g,
const std::string& name)
35 return agnode(g, const_cast<char*>(name.c_str()),
true);
38 static inline Agedge_t* _agedge(Agraph_t* g, Agnode_t* node0, Agnode_t* node1,
const std::string& name,
bool create)
40 return agedge(g, node0, node1, const_cast<char*>(name.c_str()), create);
45 return agidedge(g, node0, node1,
id, create);
63 const std::string&
getName()
const {
return mName; }
65 int x()
const {
return mCenterPosX; }
66 int y()
const {
return mCenterPosY; }
67 int height()
const {
return mHeight; }
68 int width()
const {
return mWidth; }
86 int mCenterPosX, mCenterPosY;
89 double mHeight, mWidth;
146 int setGraphAttribute(
const std::string& name,
const std::string& value);
154 std::string getGraphAttribute(
const std::string& name,
const std::string& defaultValue = std::string())
const;
161 void setNodeAttribute(
const std::string& name,
const std::string& value);
168 void setEdgeAttribute(
const std::string& name,
const std::string& value);
183 void initializeFromBaseGraph();
185 void addNodes(
const std::vector<Vertex::Ptr>& vertices);
192 void addEdges(
const std::vector<Edge::Ptr>& edges);
198 void setFont(
const std::string& fontname, uint16_t fontsizeInPt);
205 void applyLayout(
const std::string& layout =
"dot");
215 void renderToFile(
const std::string& filename,
const std::string& layout =
"dot",
const std::string& renderer =
"dot",
bool forced =
false);
216 boxf boundingRect()
const;
219 std::vector<GVNode> nodes()
const;
220 std::vector<GVEdge> edges()
const;
225 std::string getUniqueName(
const Vertex::Ptr& vertex)
const;
226 std::string getUniqueName(
const Edge::Ptr& edge)
const;
237 std::map<GraphElementId, Agnode_t*> mNodes;
239 std::map<GraphElementId, Agedge_t*> mEdges;
244 double mScalingFactor;
248 static std::set<std::string> msSupportedLayouts;
254 #endif // GRAPH_ANALYSIS_IO_GVGRAPH_HPP const std::string & getName() const
Definition: GVGraph.hpp:63
int width() const
Definition: GVGraph.hpp:68
uint32_t GraphElementId
Definition: GraphElement.hpp:21
static const double DotDefaultDPI
Default DPI value used by dot (which uses points instead of pixels for coordinates) ...
Definition: GVGraph.hpp:123
GVNode(Vertex::Ptr vertex, const std::string &name, int x, int y, double height, double width)
Definition: GVGraph.hpp:70
int y() const
Definition: GVGraph.hpp:66
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
static std::set< std::string > getSupportedLayouts()
Definition: GVGraph.hpp:125
GVEdge(Edge::Ptr edge)
Definition: GVGraph.hpp:96
GVNode()
Definition: GVGraph.hpp:59
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
int x() const
Definition: GVGraph.hpp:65
shared_ptr< BaseGraph > Ptr
Definition: BaseGraph.hpp:34
Edge::Ptr getEdge() const
Definition: GVGraph.hpp:100
An object containing a libgraph graph and its associated nodes and edges.
Definition: GVGraph.hpp:119
Vertex::Ptr getVertex() const
Definition: GVGraph.hpp:62
int height() const
Definition: GVGraph.hpp:67
Definition: GVGraph.hpp:56
A struct containing the information for a GVGraph's edge.
Definition: GVGraph.hpp:93