GraphWriter
Declared in lemon/lgf_writer.h, in the group LEMON Graph Format; the same class on the Doxygen site.
-
template< typename GR >
class GraphWriter LGF writer for undirected graphs
This utility writes an LGF file.
It can be used almost the same way as
DigraphWriter. The only difference is that this class can handle edges and edge maps as well as arcs and arc maps.The arc maps are written into the file as two columns, the caption of the columns are the name of the map prefixed with
'+'and'-'. The arcs are written into the@attributessection as a'+'or a'-'prefix (depends on the direction of the arc) and the label of corresponding edge.Warning
The values given to the node, arc, edge and attribute writing rules are kept by reference and read by run(), hence they have to exist until then: a temporary passed to a rule is destroyed at the end of the expression that passes it.
Writing Rules
-
template< typename Map >
inline GraphWriter & nodeMap( - const std::string & caption,
- const Map & map
Node map writing rule.
Add a node map writing rule to the writer.
-
template< typename Map , typename Converter >
inline GraphWriter & nodeMap(
) Node map writing rule.
Add a node map writing rule with specialized converter to the writer.
-
template< typename Map >
inline GraphWriter & edgeMap( - const std::string & caption,
- const Map & map
Edge map writing rule.
Add an edge map writing rule to the writer.
-
template< typename Map , typename Converter >
inline GraphWriter & edgeMap(
) Edge map writing rule.
Add an edge map writing rule with specialized converter to the writer.
-
template< typename Map >
inline GraphWriter & arcMap( - const std::string & caption,
- const Map & map
Arc map writing rule.
Add an arc map writing rule to the writer.
-
template< typename Map , typename Converter >
inline GraphWriter & arcMap(
) Arc map writing rule.
Add an arc map writing rule with specialized converter to the writer.
-
template< typename Value >
inline GraphWriter & attribute( - const std::string & caption,
- const Value & value
Attribute writing rule.
Add an attribute writing rule to the writer.
-
template< typename Value , typename Converter >
inline GraphWriter & attribute(
) Attribute writing rule.
Add an attribute writing rule with specialized converter to the writer.
-
inline GraphWriter & node( const std::string & caption , const Node & node )
Node writing rule.
Add a node writing rule to the writer.
-
inline GraphWriter & edge( const std::string & caption , const Edge & edge )
Edge writing rule.
Add an edge writing rule to writer.
-
inline GraphWriter & arc( const std::string & caption , const Arc & arc )
Arc writing rule.
Add an arc writing rule to writer.
Section Captions
-
inline GraphWriter & nodes( const std::string & caption )
Add an additional caption to the
@nodessection.
-
inline GraphWriter & edges( const std::string & caption )
Add an additional caption to the
@edgessection.
-
inline GraphWriter & attributes( const std::string & caption )
Add an additional caption to the
@attributessection.
Skipping Section
-
inline GraphWriter & skipNodes()
Skip writing the node set.
The
@nodessection will not be written to the stream.
-
inline GraphWriter & skipEdges()
Skip writing edge set.
The
@edgessection will not be written to the stream.
Execution of the Writer
-
inline void run()
Start the batch processing.
This function starts the batch processing.
-
inline std::ostream & ostream()
Give back the stream of the writer
Public Functions
-
inline GraphWriter( const GR & graph , std::ostream & os = std::cout )
Constructor.
Construct an undirected graph writer, which writes to the given output stream.
-
inline GraphWriter( const GR & graph , const std::string & fn )
Constructor.
Construct a undirected graph writer, which writes to the given output file.
-
inline GraphWriter( const GR & graph , const char * fn )
Constructor.
Construct a undirected graph writer, which writes to the given output file.
-
inline ~GraphWriter()
Destructor.
-
template< typename TGR >
GraphWriter< TGR > graphWriter( - const TGR & graph,
- const std::string & fn
Return a GraphWriter class.
This function just returns a GraphWriter class.
See also
graphWriter( const TGR & graph , std::ostream & os )
-
template< typename TGR >
GraphWriter< TGR > graphWriter( const TGR & graph , const char * fn ) Return a GraphWriter class.
This function just returns a GraphWriter class.
See also
graphWriter( const TGR & graph , std::ostream & os )
-
template< typename Map >