36 map<string, Agnode_t*>::iterator it =
_nodes.find(name);
45 pair<string, string> key;
57 return agsafeset(
selectNode(name),const_cast<char*>(attribute.c_str()),const_cast<char*>(value.c_str()),const_cast<char*>(
""));
64 return agsafeset(
selectEdge(source,target),const_cast<char*>(attribute.c_str()),const_cast<char*>(value.c_str()),const_cast<char*>(
""));
81 return agopen(const_cast<char*>(name.c_str()),kind);
86 string str=agget(
object, const_cast<char*>(attr.c_str()));
96 return agsafeset(
object, const_cast<char*>(attr.c_str()),const_cast<char*>(value.c_str()),const_cast<char*>(value.c_str()));
101 return agnodeattr(
_graph,const_cast<char*>(name.c_str()),const_cast<char*>(value.c_str()));
106 return agedgeattr(
_graph,const_cast<char*>(name.c_str()),const_cast<char*>(value.c_str()));
110 return agnode(
_graph,const_cast<char*>(name.c_str()));
115 return gvLayout(gvc,graph,engine.c_str());
119 _context(gvContext()),
120 _graph(_agopen(name, AGDIGRAPHSTRICT))
172 for(uint i=0; i<names.size(); ++i)
185 map< pair<string,string>, Agedge_t*>::iterator it;
189 if(it->first.first==nn || it->first.second==nn)
197 map<string, Agnode_t*>::iterator it;
202 names.push_back(it->first);
204 for(uint i=0;i<names.size();i++)
218 pair<string,string> key(source,target);
227 removeEdge(pair<string,string>(source, target));
GVGraph(string name, double node_size=50)
Construct a Graphviz graph object.
Agedge_t * selectEdge(string &source, string &target)
int _gvLayout(GVC_t *gvc, graph_t *graph, string engine)
Layout wrapper function.
Agraph_t * _graph
Agraph main object.
Agnode_t * selectNode(string &name)
Selects a node.
void addNodes(vector< string > &names)
Add several nodes.
void clearNodes()
Clear the whole graph.
GVC_t * _context
GV context main variable.
void addNode(const string &name)
Add a new node to the graph.
Agraph_t * _agopen(string name, int kind)
Open the graph.
void startRender()
Start render.
int setEdgeAttribute(string source, string target, string attribute, string value)
map< pair< string, string >, Agedge_t * > _edges
Edge map, used for edge tracking.
map< string, Agnode_t * > _nodes
Node map, used for node tracking.
void removeEdge(const string &source, const string &target)
Remove a edge.
string _agget(void *object, string attr, string alt=string())
Get graph attribute.
Agsym_t * _agedgeattr(string name, string value)
Set edge attributes.
GVGraph class declaration.
~GVGraph()
Graphviz graph destructor.
Agsym_t * _agnodeattr(string name, string value)
Set node attributes.
Agnode_t * _agnode(string name)
Low level function to add new nodes.
int setNodeAttribute(string name, string attribute, string value)
Sets node attributes.
void freeLayout()
Free the layout This function should be called before any modifications to the current graph...
void removeNode(const string &name)
Remove a node.
void addEdge(const string &source, const string &target)
Add a new edge.
void applyLayout()
Apply a new layout.
void setRootNode(const string &name)
Set a root node for the graph.
int _agset(void *object, string attr, string value)
Set attribute.
GVC_t * getGVCcontext(void)
Get the current GVC context.