28 #ifndef __DYNG_DRAW_HXX__ 29 #define __DYNG_DRAW_HXX__ 61 const std::string& name,
81 struct Color { uint8_t r, g, b; };
107 virtual bool append()
const;
110 virtual bool node(index_type nodeid,
113 std::string& desc) = 0;
116 virtual bool arc(index_type arcid,
120 std::string& desc) = 0;
123 virtual void write(std::ostream& out);
142 bool node(index_type nodeid,
147 bool arc(index_type arcid,
153 void write(std::ostream& out);
156 enum State { Exist, NotExist, Active, Corr };
160 void node_state(index_type bnodeid,
int time,
161 State& state, State& old_state)
const;
165 std::unique_ptr<Data> data;
188 const std::vector<index_type>& path);
191 const std::vector<double>& basecosts,
192 const std::vector<double>& augcosts,
193 const std::vector<index_type>& path);
196 int (*getattr)(
Attribute attr, index_type
id,
void* value),
197 const std::vector<index_type>& path);
200 const std::vector<const char*>& nodedesc,
201 const std::vector<const char*>& arcdesc,
202 const std::vector<index_type>& path);
205 const std::vector<double>& basecosts,
206 const std::vector<double>& augcosts,
207 const std::vector<const char*>& nodedesc,
208 const std::vector<const char*>& arcdesc,
209 const std::vector<index_type>& path);
213 bool node(index_type nodeid,
218 bool arc(index_type arcid,
228 std::vector<index_type> _path;
229 std::vector<index_type> _pathnodes;
230 std::vector<double> _basecosts;
231 std::vector<double> _augcosts;
232 std::unique_ptr<Description> _desc;
240 const std::vector<double>& basecosts,
241 const std::vector<double>& augcosts,
242 const std::vector<const char*>& nodedesc,
243 const std::vector<const char*>& arcdesc,
244 const std::vector<double>& flows,
251 bool node(index_type nodeid,
256 bool arc(index_type arcid,
264 std::vector<double> _flow;
265 std::vector<double> _basecosts;
266 std::vector<double> _augcosts;
267 std::unique_ptr<Description> _desc;
282 void write_corridor_grav(std::ostream& out,
const Net& net,
const std::string& name,
bool addgraph =
false);
297 const std::vector<index_type>& path,
317 const std::vector<double>& basecosts,
318 const std::vector<double>& augcosts,
319 const std::vector<index_type>& path,
338 int (*getattr)(
Attribute attr, index_type
id,
void* value),
339 const std::vector<index_type>& path,
358 const std::vector<const char*>& nodedesc,
359 const std::vector<const char*>& arcdesc,
360 const std::vector<index_type>& path,
381 const std::vector<double>& basecosts,
382 const std::vector<double>& augcosts,
383 const std::vector<const char*>& nodedesc,
384 const std::vector<const char*>& arcdesc,
385 const std::vector<index_type>& path,
404 const Net& net,
const std::string& name,
405 const std::vector<double>& basecosts,
406 const std::vector<double>& augcosts,
407 const std::vector<const char*>& nodedesc,
408 const std::vector<const char*>& arcdesc,
409 const std::vector<double>& flow,
void write_basegraph_tikz(const Net &net, bool withdoc, std::ostream &out)
Write base graph in Tikz format.
virtual bool node(index_type nodeid, Color &color, NodeShape &shape, std::string &desc)=0
Get node info.
NodeShape
The shape of a node.
Definition: draw.hxx:84
Writes the Grav with the corridor and active graph highlighted.
Definition: draw.hxx:133
virtual ~GravWriter()
Destructor.
An RGB color.
Definition: draw.hxx:81
virtual bool arc(index_type arcid, double &cost, double &flow, Color &color, std::string &desc)=0
Get arc info.
const std::string _name
name of the graph in the grav file
Definition: draw.hxx:127
void write_corridor_grav(std::ostream &out, const Net &net, const std::string &name, bool addgraph=false)
Write time expansion in grav format.
void write_basegraph_grav(const Net &net, const std::string &name, std::ostream &out)
Write base graph in grav format.
void write_flow_grav(std::ostream &out, const Net &net, const std::string &name, const std::vector< double > &basecosts, const std::vector< double > &augcosts, const std::vector< const char *> &nodedesc, const std::vector< const char *> &arcdesc, const std::vector< double > &flow, bool append=false)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Writes a path.
Definition: draw.hxx:184
GravWriter(const Net &net, const std::string &name)
Create a GravWriter for a network.
base cost of an arc, double
Definition: draw.hxx:172
time description, c string of size 80
Definition: draw.hxx:176
cost of an arc, double
Definition: draw.hxx:171
Attribute
Attribute for building node/arc descriptions.
Definition: draw.hxx:170
virtual bool append() const
Returns true iff the graph to be written should be appended.
Grav writer for fractional flows.
Definition: draw.hxx:236
int index_type
Type of indices.
Definition: draw.hxx:39
void write_grav(const Net &net, const std::string &name, const std::vector< index_type > &path, std::ostream &out)
Write time expansion in grav format with some highlighted path.
A dynamic time expanded network.
Definition: Net.hxx:458
node description, c string of size 80
Definition: draw.hxx:175
void write_rgraph(const Net &net, std::ostream &out)
Write time expansion in rgraph format.
Base class for writing to Grav files.
Definition: draw.hxx:77
const Net & _net
the network to be drawn
Definition: draw.hxx:126
The namespace of DynG.
Definition: draw.hxx:36
flow of an arc, double
Definition: draw.hxx:174
virtual void write(std::ostream &out)
Write the graph to the given output stream.
augmented cost of an arc, double
Definition: draw.hxx:173
bool append() const
Returns true iff the graph to be written should be appended.
Definition: draw.hxx:249