Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::GraphIO Class Reference

Utility class providing graph I/O in various exchange formats. More...

#include <ogdf/fileformats/GraphIO.h>

Classes

struct  FileType
 
class  SVGSettings
 Condensed settings for drawing SVGs. More...
 

Public Types

using AttrReaderFunc = bool(*)(GraphAttributes &, Graph &, std::istream &)
 Type of simple graph attributes reader functions working on streams. More...
 
using AttrWriterFunc = bool(*)(const GraphAttributes &, std::ostream &)
 Type of simple graph attributes writer functions working on streams. More...
 
using ClusterAttrReaderFunc = bool(*)(ClusterGraphAttributes &, ClusterGraph &, Graph &, std::istream &)
 Type of cluster graph attributes reader functions working on streams. More...
 
using ClusterAttrWriterFunc = bool(*)(const ClusterGraphAttributes &, std::ostream &)
 Type of cluster graph attributes writer functions working on streams. More...
 
using ClusterReaderFunc = bool(*)(ClusterGraph &, Graph &, std::istream &)
 Type of cluster graph reader functions working on streams. More...
 
using ClusterWriterFunc = bool(*)(const ClusterGraph &, std::ostream &)
 Type of cluster graph writer functions working on streams. More...
 
using ReaderFunc = bool(*)(Graph &, std::istream &)
 Type of simple graph reader functions working on streams. More...
 
using WriterFunc = bool(*)(const Graph &, std::ostream &)
 Type of simple graph writer functions working on streams. More...
 

Static Public Member Functions

static const FileTypegetFileType (const string &filename)
 
static const std::unordered_map< string, const FileType * > & getFileTypeMap ()
 
Graphs

These functions read and write graphs (instances of type Graph) in various graph formats.

If you have a stream object and know the file format beforehand, you can call the corresponding method directly (e.g. readGML or writeGML). If you have a filename and the format is fixed, you can use the following methods and pass the desired method for your format. If you have a filename and the format should be determined from the file extension, use the following methods without passing a method. If you have a stream and the format should be determined from its contents, use read and pass your stream.

Supported File Types
NameKnown Extensions Read GraphWrite GraphRead GraphAttributesWrite GraphAttributes Read ClusterGraphWrite ClusterGraphRead ClusterGraphAttributesWrite ClusterGraphAttributes
DOT .dot, .gv XXXXXXXX
GML .gml XXXXXXXX
TLP .tlp XXXXXXXX
LEDA .leda XX
Chaco .chaco XX
DL .dl XXXX
GDF .gdf XXXX
GraphML .graphml XXXXXXXX
GEXF .gexf XXXXXXXX
STP .stp XX
Graph6 .g6 XX
Digraph6 .d6 XX
Sparse6 .s6 XX
DMF .dmf XX
PMDiss .pm, .pmd XX
Rudy .rudy XXX
SVG .svg XX
Rome .rome, .grafoX.Y XX
MatrixMarket .mtx X
TikZ .tex XX
TsplibXml .xml XX

Note: The Rome and MatrixMarket formats won't be guessed from an input stream, as they would also wrongly interpret files of other formats. Use a filename matching "*.rome" or "grafo*.*" / "*.mtx" or pass the readRome / readMatrixMarket reader explicitly if you are reading Rome / MatrixMarket files. Similarly, (Di)Graph6/Sparse6 files will only be guessed from an input stream if they include the header specified as optional by the file format. If you have a (Di)Graph6/Sparse6 file without a header, pass it using its filename (with the appropriate extension) or pass the right reader function explicitly.

See also
std::vector<FileType> FILE_TYPES
static bool read (Graph &G, const string &filename, ReaderFunc reader=nullptr)
 Reads graph G from a file with name filename and infers the used format from the file's extension. More...
 
static bool read (GraphAttributes &GA, Graph &G, const string &filename, AttrReaderFunc reader=nullptr)
 Reads graph G and its attributes GA from a file with name filename and infers the used format from the file's extension. More...
 
static bool read (ClusterGraph &CG, Graph &G, const string &filename, ClusterReaderFunc reader=nullptr)
 Reads graph G and a clustering CG of G from a file with name filename and infers the used format from the file's extension. More...
 
static bool read (ClusterGraphAttributes &GA, ClusterGraph &CG, Graph &G, const string &filename, ClusterAttrReaderFunc reader=nullptr)
 Reads graph G, a clustering CG of G and their attributes CGA from a file with name filename and infers the used format from the file's extension. More...
 
static bool read (Graph &G, std::istream &is)
 Reads graph G from a stream is and try to guess the contained format by trying all available readers. More...
 
static bool read (GraphAttributes &GA, Graph &G, std::istream &is)
 Reads graph G and its attributes GA from a stream is and try to guess the contained format by trying all available readers. More...
 
static bool read (ClusterGraph &CG, Graph &G, std::istream &is)
 Reads graph G and a clustering CG of G from a stream is and try to guess the contained format by trying all available readers. More...
 
static bool read (ClusterGraphAttributes &GA, ClusterGraph &CG, Graph &G, std::istream &is)
 Reads graph G, a clustering CG of G and their attributes GA from a stream is and try to guess the contained format by trying all available readers. More...
 
static bool write (const Graph &G, const string &filename, WriterFunc writer=nullptr)
 Writes graph G to a file with name filename and infers the format to use from the file's extension. More...
 
static bool write (const GraphAttributes &GA, const string &filename, AttrWriterFunc writer=nullptr)
 Writes graph G and its attributes GA to a file with name filename and infers the format to use from the file's extension. More...
 
static bool write (const ClusterGraph &CG, const string &filename, ClusterWriterFunc writer=nullptr)
 Writes graph G and a clustering CG of G to a file with name filename and infers the format to use from the file's extension. More...
 
static bool write (const ClusterGraphAttributes &GA, const string &filename, ClusterAttrWriterFunc writer=nullptr)
 Writes graph G, a clustering CG of G and their attributes CGA to a file with name filename and infers the format to use from the file's extension. More...
 
GML
static bool readGML (Graph &G, std::istream &is)
 Reads graph G in GML format from input stream is. More...
 
static bool writeGML (const Graph &G, std::ostream &os)
 Writes graph G in GML format to output stream os. More...
 
static bool readGML (ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) in GML format from input stream is. More...
 
static bool writeGML (const ClusterGraph &C, std::ostream &os)
 Writes clustered graph C in GML format to output stream os. More...
 
static bool readGML (ClusterGraphAttributes &A, ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) with attributes A in GML format from input stream is. More...
 
static bool writeGML (const ClusterGraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in GML format to output stream os. More...
 
static bool readGML (GraphAttributes &A, Graph &G, std::istream &is)
 Reads graph G with attributes A in GML format from input stream is. More...
 
static bool writeGML (const GraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in GML format to output stream os. More...
 
Rome
static bool readRome (Graph &G, std::istream &is)
 Reads graph G in Rome-Lib format from input stream is. More...
 
static bool writeRome (const Graph &G, std::ostream &os)
 Writes graph G in Rome-Lib format to output stream os. More...
 
LEDA
static bool readLEDA (Graph &G, std::istream &is)
 Reads graph G in LEDA graph format from input stream is. More...
 
static bool writeLEDA (const Graph &G, std::ostream &os)
 Writes graph G in LEDA graph format to output stream os. More...
 
Chaco
static bool readChaco (Graph &G, std::istream &is)
 Reads graph G in Chaco format from input stream is. More...
 
static bool writeChaco (const Graph &G, std::ostream &os)
 Writes graph G in Chaco format to output stream os. More...
 
PMDissGraph

Graph file format from [Petra Mutzel, The maximum planar subgraph problem, PhD Thesis, Köln University, 1994]

static bool readPMDissGraph (Graph &G, std::istream &is)
 Reads graph G in a simple format as used in Petra Mutzel's thesis from input stream is. More...
 
static bool writePMDissGraph (const Graph &G, std::ostream &os)
 Writes graph G in a simple format as used in Petra Mutzel's thesis to output stream os. More...
 
YGraph
static bool readYGraph (Graph &G, std::istream &is)
 Reads graph G in Y-graph format from input stream is. More...
 
Graph6

The Graph6 format represents an (preferable dense or small) simple undirected graph as a string containing printable characters between 0x3F and 0x7E.

See the specification for more information.

static bool readGraph6 (Graph &G, std::istream &is, bool forceHeader=false)
 Reads graph G in Graph6 format from input stream is. More...
 
static bool writeGraph6 (const Graph &G, std::ostream &os)
 Writes graph G in Graph6 format to output stream os. More...
 
Digraph6

The Digraph6 format represents simple directed graphs (allowing loops) as a string containing printable characters between 0x3F and 0x7E.

See the specification for more information.

static bool readDigraph6 (Graph &G, std::istream &is, bool forceHeader=false)
 Reads graph G in Digraph6 format from input stream is. More...
 
static bool writeDigraph6 (const Graph &G, std::ostream &os)
 Writes graph G in Digraph6 format to output stream os. More...
 
Sparse6

The Sparse6 format represents a (preferably sparse) undirected graph as a string containing printable characters between 0x3F and 0x7E.

See the specification for more information.

static bool readSparse6 (Graph &G, std::istream &is, bool forceHeader=false)
 Reads graph G in Sparse6 format from input stream is. More...
 
static bool writeSparse6 (const Graph &G, std::ostream &os)
 Writes graph G in Sparse6 format to output stream os. More...
 
MatrixMarket
static bool readMatrixMarket (Graph &G, std::istream &inStream)
 Reads graph G in Matrix Market exchange format from stream inStream. More...
 
Rudy
static bool readRudy (GraphAttributes &A, Graph &G, std::istream &is)
 Reads graph G with edge weights stored in A in Rudy format from input stream is. More...
 
static bool readRudy (Graph &G, std::istream &is)
 Reads graph G in Rudy format from input stream is. More...
 
static bool writeRudy (const GraphAttributes &A, std::ostream &os)
 Writes graph with edge weights stored in A in Rudy format to output stream os. More...
 
BENCH
static bool readBENCH (Graph &G, List< node > &hypernodes, List< edge > *shell, std::istream &is)
 Reads a hypergraph (as point-based expansion) in BENCH format from input stream is. More...
 
PLA
static bool readPLA (Graph &G, List< node > &hypernodes, List< edge > *shell, std::istream &is)
 Reads a hypergraph (as point-based expansion) in PLA format from input stream is. More...
 
GD-Challenge

Graph Drawing Challenge: Area Minimization for Orthogonal Grid Layouts http://graphdrawing.de/contest2013/challenge.html

static bool readChallengeGraph (Graph &G, GridLayout &gl, std::istream &is)
 Reads graph G with grid layout gl in GD-Challenge-format from input stream is. More...
 
static bool writeChallengeGraph (const Graph &G, const GridLayout &gl, std::ostream &os)
 Writes graph G with grid layout gl in GD-Challenge-format to output stream os. More...
 
GraphML

Graph Markup Language: http://graphml.graphdrawing.org/

static bool readGraphML (Graph &G, std::istream &is)
 Reads graph G in GraphML format from input stream is. More...
 
static bool readGraphML (ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) in GraphML format from input stream is. More...
 
static bool readGraphML (GraphAttributes &A, Graph &G, std::istream &is)
 Reads graph G with attributes A in GraphML format from input stream is. More...
 
static bool readGraphML (ClusterGraphAttributes &A, ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) with attributes A in GraphML format from input stream is. More...
 
static bool writeGraphML (const Graph &G, std::ostream &os)
 Writes graph G in GraphML format to output stream os. More...
 
static bool writeGraphML (const ClusterGraph &C, std::ostream &os)
 Writes clustered graph C in GraphML format to output stream os. More...
 
static bool writeGraphML (const GraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in GraphML format to output stream os. More...
 
static bool writeGraphML (const ClusterGraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in GraphML format to output stream os. More...
 
DOT
static bool readDOT (Graph &G, std::istream &is)
 Reads graph G in DOT format from input stream is. More...
 
static bool readDOT (ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) in DOT format from input stream is. More...
 
static bool readDOT (GraphAttributes &A, Graph &G, std::istream &is)
 Reads graph G with attributes A in DOT format from input stream is. More...
 
static bool readDOT (ClusterGraphAttributes &A, ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) with attributes A in DOT format from input stream is. More...
 
static bool writeDOT (const Graph &G, std::ostream &os)
 Writes graph G in DOT format to output stream os. More...
 
static bool writeDOT (const ClusterGraph &C, std::ostream &os)
 Writes clustered graph C in DOT format to output stream os. More...
 
static bool writeDOT (const GraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in DOT format to output stream os. More...
 
static bool writeDOT (const ClusterGraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in DOT format to output stream os. More...
 
GEXF

Graph Exchange XML Format: https://gephi.org/gexf/format/

static bool readGEXF (Graph &G, std::istream &is)
 Reads graph G in GEXF format from input stream is. More...
 
static bool readGEXF (ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) in GEXF format from input stream is. More...
 
static bool readGEXF (GraphAttributes &A, Graph &G, std::istream &is)
 Reads graph G with attributes A in GEXF format from input stream is. More...
 
static bool readGEXF (ClusterGraphAttributes &A, ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) with attributes A in GEXF format from input stream is. More...
 
static bool writeGEXF (const Graph &G, std::ostream &os)
 Writes graph G in GEXF format to output stream os. More...
 
static bool writeGEXF (const ClusterGraph &C, std::ostream &os)
 Writes clustered graph C in GEXF format to output stream os. More...
 
static bool writeGEXF (const GraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in GEXF format to output stream os. More...
 
static bool writeGEXF (const ClusterGraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in GEXF format to output stream os. More...
 
GDF
static bool readGDF (Graph &G, std::istream &is)
 Reads graph G in GDF format from input stream is. More...
 
static bool readGDF (GraphAttributes &A, Graph &G, std::istream &is)
 Reads graph G with attributes A in GDF format from input stream is. More...
 
static bool writeGDF (const Graph &G, std::ostream &os)
 Writes graph G in GDF format to output stream os. More...
 
static bool writeGDF (const GraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in GDF format to output stream os. More...
 
TLP
static bool readTLP (Graph &G, std::istream &is)
 Reads graph G in TLP format from input stream is. More...
 
static bool readTLP (ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) in TLP format from input stream is. More...
 
static bool readTLP (GraphAttributes &A, Graph &G, std::istream &is)
 Reads graph G with attributes A in TLP format from input stream is. More...
 
static bool readTLP (ClusterGraphAttributes &A, ClusterGraph &C, Graph &G, std::istream &is)
 Reads clustered graph (C, G) with attributes A in TLP format from input stream is. More...
 
static bool writeTLP (const Graph &G, std::ostream &os)
 Writes graph G in TLP format to output stream os. More...
 
static bool writeTLP (const ClusterGraph &C, std::ostream &os)
 Writes clustered graph C in TLP format to output stream os. More...
 
static bool writeTLP (const GraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in TLP format to output stream os. More...
 
static bool writeTLP (const ClusterGraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in TLP format to output stream os. More...
 
DL
static bool readDL (Graph &G, std::istream &is)
 Reads graph G in DL format from input stream is. More...
 
static bool readDL (GraphAttributes &A, Graph &G, std::istream &is)
 Reads graph G with attributes A in DL format from input stream is. More...
 
static bool writeDL (const Graph &G, std::ostream &os)
 Writes graph G in DL format to output stream os. More...
 
static bool writeDL (const GraphAttributes &A, std::ostream &os)
 Writes graph with attributes A in DL format to output stream os. More...
 
STP

SteinLib STP Data Format: http://steinlib.zib.de/format.php

static bool readSTP (GraphAttributes &attr, Graph &G, List< node > &terminals, NodeArray< bool > &isTerminal, std::istream &is)
 Reads a graph in SteinLib format from std::istream is. More...
 
static bool readSTP (GraphAttributes &attr, Graph &G, std::istream &is)
 Reads a graph in SteinLib format from std::istream is. More...
 
static bool readSTP (Graph &G, std::istream &is)
 Reads a graph in SteinLib format from std::istream is. More...
 
template<typename T >
static bool readSTP (EdgeWeightedGraph< T > &wG, List< node > &terminals, NodeArray< bool > &isTerminal, std::istream &is)
 Reads a SteinLib instance from an inputstream is and converts it into a weighted graph wG and a set of terminal nodes terminals. More...
 
static bool writeSTP (const GraphAttributes &attr, const List< node > &terminals, std::ostream &os, const string &comments="")
 Writes an Steiner problem instance to an STP file. More...
 
template<typename T >
static bool writeSTP (const EdgeWeightedGraph< T > &wG, const List< node > &terminals, std::ostream &os, const string &comments="")
 Writes an Steiner problem instance to an STP file. More...
 
DMF

DIMACS Max Flow Challenge: ftp://dimacs.rutgers.edu/pub/netflow/

static bool readDMF (GraphAttributes &attr, Graph &graph, node &source, node &sink, std::istream &is)
 Reads a maximum flow instance in DIMACS format. More...
 
static bool readDMF (GraphAttributes &attr, Graph &graph, std::istream &is)
 Reads a maximum flow instance in DIMACS format. More...
 
template<typename T >
static bool readDMF (Graph &graph, EdgeArray< T > &weights, node &source, node &sink, std::istream &is)
 Reads a maximum flow instance in DIMACS format. More...
 
static bool readDMF (Graph &graph, std::istream &is)
 Reads a maximum flow instance in DIMACS format. More...
 
static bool writeDMF (const GraphAttributes &attr, const node source, const node sink, std::ostream &os)
 Writes a maximum flow problem instance to a DIMACS maximum flow file. More...
 
template<typename T >
static bool writeDMF (const Graph &graph, const EdgeArray< T > &weights, const node source, const node sink, std::ostream &os)
 Writes a maximum flow problem instance to a DIMACS maximum flow file. More...
 
TsplibXml

Unified xml format of Tsplib instances: http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/

static bool readTsplibXml (Graph &G, std::istream &is)
 Reads graph G in TsplibXml format from input stream is. More...
 
static bool readTsplibXml (GraphAttributes &GA, Graph &G, std::istream &is)
 Reads graph G with attributes GA in TsplibXml format from input stream is. More...
 
Graphs with subgraph

These functions read and write graphs in a simple text-based file format that also specifies a subgraph (given as a list of edges).

static bool readEdgeListSubgraph (Graph &G, List< edge > &delEdges, std::istream &is)
 Reads graph G with subgraph defined by delEdges from stream is. More...
 
static bool writeEdgeListSubgraph (const Graph &G, const List< edge > &delEdges, std::ostream &os)
 Writes graph G with subgraph defined by delEdges to stream os. More...
 
Graphics formats

These functions draw graphs and export them as SVG (Scalable Vector Graphics) or LaTeX+TikZ vectors graphics.

static bool drawSVG (const GraphAttributes &A, std::ostream &os, const SVGSettings &settings)
 
static bool drawSVG (const GraphAttributes &A, std::ostream &os)
 
static bool drawSVG (const GraphAttributes &A, const string &filename, const SVGSettings &settings=svgSettings)
 
static bool drawSVG (const ClusterGraphAttributes &A, std::ostream &os, const SVGSettings &settings)
 
static bool drawSVG (const ClusterGraphAttributes &A, std::ostream &os)
 
static bool drawSVG (const ClusterGraphAttributes &A, const string &filename, const SVGSettings &settings=svgSettings)
 
static bool drawTikz (const GraphAttributes &A, std::ostream &os)
 Draws a graph from its attributes in LaTeX+TikZ format. More...
 
static bool drawTikz (const ClusterGraphAttributes &A, std::ostream &os)
 Draws a cluster graph from its attributes in LaTeX+TikZ format. More...
 
Utility functions for indentation

Text based write methods that use indentation for better readability of the produced text files apply a customizable indentation character and indentation width.

static char indentChar ()
 Returns the currently used indentation character. More...
 
static int indentWidth ()
 Returns the currently used indentation width. More...
 
static void setIndentChar (char c)
 Sets the indentation character to c. More...
 
static void setIndentWidth (int w)
 Sets the indentation width to w. More...
 
static std::ostream & indent (std::ostream &os, int depth)
 Prints indentation for indentation depth to output stream os and returns os. More...
 
Other utility functions
static bool setColorValue (int value, std::function< void(uint8_t)> setFunction)
 Set a color value (R/G/B/A) based on an integer. Checks if the value is in the right range. More...
 
template<typename T , typename std::enable_if< std::is_integral< T >::value, bool >::type = 0>
static long getEdgeWeightFlag ()
 Returns GraphAttributes::edgeIntWeight. More...
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, bool >::type = 0>
static long getEdgeWeightFlag ()
 Returns GraphAttributes::edgeDoubleWeight. More...
 
template<typename T , typename std::enable_if< std::is_integral< T >::value, bool >::type = 0>
static int & getEdgeWeightAttribute (GraphAttributes &attr, edge e)
 Returns a reference to the intWeight()-value of attr for e. More...
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, bool >::type = 0>
static double & getEdgeWeightAttribute (GraphAttributes &attr, edge e)
 Returns a reference to the doubleWeight()-value of attr for e. More...
 

Static Public Attributes

static std::unordered_map< string, const FileType * > FILE_TYPE_MAP
 
static const std::vector< FileTypeFILE_TYPES
 
static Logger logger
 
static SVGSettings svgSettings
 

Static Private Attributes

static char s_indentChar
 Character used for indentation. More...
 
static int s_indentWidth
 Number of indent characters used for indentation. More...
 

Detailed Description

Utility class providing graph I/O in various exchange formats.

Definition at line 62 of file GraphIO.h.

Member Typedef Documentation

◆ AttrReaderFunc

using ogdf::GraphIO::AttrReaderFunc = bool (*)(GraphAttributes&, Graph&, std::istream&)

Type of simple graph attributes reader functions working on streams.

Definition at line 73 of file GraphIO.h.

◆ AttrWriterFunc

using ogdf::GraphIO::AttrWriterFunc = bool (*)(const GraphAttributes&, std::ostream&)

Type of simple graph attributes writer functions working on streams.

Definition at line 76 of file GraphIO.h.

◆ ClusterAttrReaderFunc

Type of cluster graph attributes reader functions working on streams.

Definition at line 86 of file GraphIO.h.

◆ ClusterAttrWriterFunc

using ogdf::GraphIO::ClusterAttrWriterFunc = bool (*)(const ClusterGraphAttributes&, std::ostream&)

Type of cluster graph attributes writer functions working on streams.

Definition at line 89 of file GraphIO.h.

◆ ClusterReaderFunc

using ogdf::GraphIO::ClusterReaderFunc = bool (*)(ClusterGraph&, Graph&, std::istream&)

Type of cluster graph reader functions working on streams.

Definition at line 79 of file GraphIO.h.

◆ ClusterWriterFunc

using ogdf::GraphIO::ClusterWriterFunc = bool (*)(const ClusterGraph&, std::ostream&)

Type of cluster graph writer functions working on streams.

Definition at line 82 of file GraphIO.h.

◆ ReaderFunc

using ogdf::GraphIO::ReaderFunc = bool (*)(Graph&, std::istream&)

Type of simple graph reader functions working on streams.

Definition at line 67 of file GraphIO.h.

◆ WriterFunc

using ogdf::GraphIO::WriterFunc = bool (*)(const Graph&, std::ostream&)

Type of simple graph writer functions working on streams.

Definition at line 70 of file GraphIO.h.

Member Function Documentation

◆ drawSVG() [1/6]

static bool ogdf::GraphIO::drawSVG ( const ClusterGraphAttributes A,
const string &  filename,
const SVGSettings settings = svgSettings 
)
inlinestatic

Definition at line 1822 of file GraphIO.h.

◆ drawSVG() [2/6]

static bool ogdf::GraphIO::drawSVG ( const ClusterGraphAttributes A,
std::ostream &  os 
)
inlinestatic

Definition at line 1818 of file GraphIO.h.

◆ drawSVG() [3/6]

static bool ogdf::GraphIO::drawSVG ( const ClusterGraphAttributes A,
std::ostream &  os,
const SVGSettings settings 
)
static

◆ drawSVG() [4/6]

static bool ogdf::GraphIO::drawSVG ( const GraphAttributes A,
const string &  filename,
const SVGSettings settings = svgSettings 
)
inlinestatic

Definition at line 1809 of file GraphIO.h.

◆ drawSVG() [5/6]

static bool ogdf::GraphIO::drawSVG ( const GraphAttributes A,
std::ostream &  os 
)
inlinestatic

Definition at line 1803 of file GraphIO.h.

◆ drawSVG() [6/6]

static bool ogdf::GraphIO::drawSVG ( const GraphAttributes A,
std::ostream &  os,
const SVGSettings settings 
)
static

◆ drawTikz() [1/2]

static bool ogdf::GraphIO::drawTikz ( const ClusterGraphAttributes A,
std::ostream &  os 
)
static

Draws a cluster graph from its attributes in LaTeX+TikZ format.

Parameters
Athe cluster graph's attributes
osoutput stream
Returns
true iff successful

◆ drawTikz() [2/2]

static bool ogdf::GraphIO::drawTikz ( const GraphAttributes A,
std::ostream &  os 
)
static

Draws a graph from its attributes in LaTeX+TikZ format.

Parameters
Athe graph's attributes
osoutput stream
Returns
true iff successful

◆ getEdgeWeightAttribute() [1/2]

template<typename T , typename std::enable_if< std::is_integral< T >::value, bool >::type = 0>
static int& ogdf::GraphIO::getEdgeWeightAttribute ( GraphAttributes attr,
edge  e 
)
inlinestatic

Returns a reference to the intWeight()-value of attr for e.

Precondition
attribute edgeIntWeight must be enabled. Helps with templated access to GraphAttributes edgeWeight type by forwarding to the respective GraphAttributes::xxxWeight(edge e) function

Definition at line 1923 of file GraphIO.h.

◆ getEdgeWeightAttribute() [2/2]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, bool >::type = 0>
static double& ogdf::GraphIO::getEdgeWeightAttribute ( GraphAttributes attr,
edge  e 
)
inlinestatic

Returns a reference to the doubleWeight()-value of attr for e.

Precondition
attribute edgeDoubleWeight must be enabled. Helps with templated access to GraphAttributes edgeWeight type by forwarding to the respective GraphAttributes::xxxWeight(edge e) function

Definition at line 1934 of file GraphIO.h.

◆ getEdgeWeightFlag() [1/2]

template<typename T , typename std::enable_if< std::is_integral< T >::value, bool >::type = 0>
static long ogdf::GraphIO::getEdgeWeightFlag ( )
inlinestatic

Returns GraphAttributes::edgeIntWeight.

Helps with templated access to GraphAttributes edgeWeight type

Definition at line 1903 of file GraphIO.h.

◆ getEdgeWeightFlag() [2/2]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, bool >::type = 0>
static long ogdf::GraphIO::getEdgeWeightFlag ( )
inlinestatic

Returns GraphAttributes::edgeDoubleWeight.

Helps with templated access to GraphAttributes edgeWeight type

Definition at line 1912 of file GraphIO.h.

◆ getFileType()

static const FileType* ogdf::GraphIO::getFileType ( const string &  filename)
static

◆ getFileTypeMap()

static const std::unordered_map<string, const FileType*>& ogdf::GraphIO::getFileTypeMap ( )
static

◆ indent()

static std::ostream& ogdf::GraphIO::indent ( std::ostream &  os,
int  depth 
)
static

Prints indentation for indentation depth to output stream os and returns os.

◆ indentChar()

static char ogdf::GraphIO::indentChar ( )
inlinestatic

Returns the currently used indentation character.

Definition at line 1855 of file GraphIO.h.

◆ indentWidth()

static int ogdf::GraphIO::indentWidth ( )
inlinestatic

Returns the currently used indentation width.

Definition at line 1858 of file GraphIO.h.

◆ read() [1/8]

static bool ogdf::GraphIO::read ( ClusterGraph CG,
Graph G,
const string &  filename,
ClusterReaderFunc  reader = nullptr 
)
static

Reads graph G and a clustering CG of G from a file with name filename and infers the used format from the file's extension.

Parameters
Gthe Graph
CGits clusters
filenamethe file
readerformat to be used (e.g. readGML), use nullptr (the default) for automated detection from filename extension or read(Graph &G, std::istream &is) for trying all available readers
Returns
true if successful, false otherwise.

◆ read() [2/8]

static bool ogdf::GraphIO::read ( ClusterGraph CG,
Graph G,
std::istream &  is 
)
static

Reads graph G and a clustering CG of G from a stream is and try to guess the contained format by trying all available readers.

See also
read(ClusterGraph &CG, Graph &G, const string &filename, ClusterReaderFunc reader = nullptr)
Parameters
Gthe Graph
CGits clusters
isstream for reading, must support seekg.
Returns
true if successful, false otherwise.

◆ read() [3/8]

static bool ogdf::GraphIO::read ( ClusterGraphAttributes GA,
ClusterGraph CG,
Graph G,
const string &  filename,
ClusterAttrReaderFunc  reader = nullptr 
)
static

Reads graph G, a clustering CG of G and their attributes CGA from a file with name filename and infers the used format from the file's extension.

Parameters
Gthe Graph
CGits clusters
GAtheir attributes
filenamethe file
readerformat to be used (e.g. readGML), use nullptr (the default) for automated detection from filename extension or read(Graph &G, std::istream &is) for trying all available readers
Returns
true if successful, false otherwise.

◆ read() [4/8]

static bool ogdf::GraphIO::read ( ClusterGraphAttributes GA,
ClusterGraph CG,
Graph G,
std::istream &  is 
)
static

Reads graph G, a clustering CG of G and their attributes GA from a stream is and try to guess the contained format by trying all available readers.

See also
read(ClusterGraphAttributes &GA, ClusterGraph &CG, Graph &G, const string &filename, ClusterAttrReaderFunc reader = nullptr)
Parameters
Gthe Graph
CGits clusters
GAtheir attributes
isstream for reading, must support seekg.
Returns
true if successful, false otherwise.

◆ read() [5/8]

static bool ogdf::GraphIO::read ( Graph G,
const string &  filename,
ReaderFunc  reader = nullptr 
)
static

Reads graph G from a file with name filename and infers the used format from the file's extension.

Parameters
Gthe Graph
filenamethe file
readerformat to be used (e.g. readGML), use nullptr (the default) for automated detection from filename extension or read(Graph &G, std::istream &is) for trying all available readers
Returns
true if successful, false otherwise.

◆ read() [6/8]

static bool ogdf::GraphIO::read ( Graph G,
std::istream &  is 
)
static

Reads graph G from a stream is and try to guess the contained format by trying all available readers.

See also
read(Graph &G, const string &filename, ReaderFunc reader = nullptr)
Parameters
Gthe Graph
isstream for reading, must support seekg.
Returns
true if successful, false otherwise.

◆ read() [7/8]

static bool ogdf::GraphIO::read ( GraphAttributes GA,
Graph G,
const string &  filename,
AttrReaderFunc  reader = nullptr 
)
static

Reads graph G and its attributes GA from a file with name filename and infers the used format from the file's extension.

Parameters
Gthe Graph
GAits attributes
filenamethe file
readerformat to be used (e.g. readGML), use nullptr (the default) for automated detection from filename extension or read(Graph &G, std::istream &is) for trying all available readers
Returns
true if successful, false otherwise.

◆ read() [8/8]

static bool ogdf::GraphIO::read ( GraphAttributes GA,
Graph G,
std::istream &  is 
)
static

Reads graph G and its attributes GA from a stream is and try to guess the contained format by trying all available readers.

See also
read(GraphAttributes &GA, Graph &G, const string &filename, AttrReaderFunc reader = nullptr)
Parameters
Gthe Graph
GAits attributes
isstream for reading, must support seekg.
Returns
true if successful, false otherwise.

◆ readBENCH()

static bool ogdf::GraphIO::readBENCH ( Graph G,
List< node > &  hypernodes,
List< edge > *  shell,
std::istream &  is 
)
static

Reads a hypergraph (as point-based expansion) in BENCH format from input stream is.

A hypergraph in OGDF is represented by its point-based expansion, i.e., for each hyperedge h we have a corresponding hypernode n. All nodes originally incident to h are incident to n, i.e., have regular edges to n.

Warning
This is a very simple implementation only usable for very properly formatted files!
Parameters
Gis assigned the read graph (point-based expansion of the hypergraph).
hypernodesis assigned the list of nodes which have to be interpreted as hypernodes.
shellif 0 only the BENCH-hypergraph is read. Otherwise we extend the graph by a simple edge e=(i,o) and two hyperedges: one hyperedges groups all input nodes and i together, the other hyperedge groups all output edges and o. These additional edges are then also collocated in shell.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readChaco()

static bool ogdf::GraphIO::readChaco ( Graph G,
std::istream &  is 
)
static

Reads graph G in Chaco format from input stream is.

This simple graph format is used by graph partitioning tools like Chaco, Metis, or Jostle. Its specification is described in the Jostle User Guide.

See also
writeChaco(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readChallengeGraph()

static bool ogdf::GraphIO::readChallengeGraph ( Graph G,
GridLayout gl,
std::istream &  is 
)
static

Reads graph G with grid layout gl in GD-Challenge-format from input stream is.

Precondition
G is the graph associated with grid layout gl.
See also
writeChallengeGraph(const Graph &G, const GridLayout &gl, std::ostream &os)
Parameters
Gis assigned the read graph.
glis assigned the grid layout.
isis the input stream from which the graph is read.
Returns
true if successful, false otherwise.

◆ readDigraph6()

static bool ogdf::GraphIO::readDigraph6 ( Graph G,
std::istream &  is,
bool  forceHeader = false 
)
static

Reads graph G in Digraph6 format from input stream is.

See also
writeDigraph6(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
forceHeaderif the file has to start with '>>digraph6<<'.
Returns
true if successful, false otherwise.

◆ readDL() [1/2]

static bool ogdf::GraphIO::readDL ( Graph G,
std::istream &  is 
)
static

Reads graph G in DL format from input stream is.

See also
writeDL(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readDL() [2/2]

static bool ogdf::GraphIO::readDL ( GraphAttributes A,
Graph G,
std::istream &  is 
)
static

Reads graph G with attributes A in DL format from input stream is.

Precondition
G is the graph associated with attributes A.
See also
writeDL(const GraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readDMF() [1/4]

template<typename T >
static bool ogdf::GraphIO::readDMF ( Graph graph,
EdgeArray< T > &  weights,
node source,
node sink,
std::istream &  is 
)
inlinestatic

Reads a maximum flow instance in DIMACS format.

Parameters
graphwill contain the parsed graph
weightswill contain the weights of the edges
sourcewill contain the flow source
sinkwill contain the flow sink
isinput stream
Template Parameters
thetype of the edge weights
Returns
true iff the instance was parsed successfully

Definition at line 1671 of file GraphIO.h.

◆ readDMF() [2/4]

static bool ogdf::GraphIO::readDMF ( Graph graph,
std::istream &  is 
)
inlinestatic

Reads a maximum flow instance in DIMACS format.

Warning
The weights as well as the source and sink nodes are ignored.
Parameters
graphis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

Definition at line 1690 of file GraphIO.h.

◆ readDMF() [3/4]

static bool ogdf::GraphIO::readDMF ( GraphAttributes attr,
Graph graph,
node source,
node sink,
std::istream &  is 
)
static

Reads a maximum flow instance in DIMACS format.

Parameters
attrwill contain the weights of the edges (GraphAttributes::intWeight or GraphAttributes::doubleWeight has to be set)
graphwill contain the parsed graph
isinput stream
Returns
true iff the instance was parsed successfully
Parameters
sourcewill contain the flow source
sinkwill contain the flow sink

◆ readDMF() [4/4]

static bool ogdf::GraphIO::readDMF ( GraphAttributes attr,
Graph graph,
std::istream &  is 
)
inlinestatic

Reads a maximum flow instance in DIMACS format.

Parameters
attrwill contain the weights of the edges (GraphAttributes::intWeight or GraphAttributes::doubleWeight has to be set)
graphwill contain the parsed graph
isinput stream
Returns
true iff the instance was parsed successfully

Definition at line 1652 of file GraphIO.h.

◆ readDOT() [1/4]

static bool ogdf::GraphIO::readDOT ( ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) in DOT format from input stream is.

Precondition
G is the graph associated with clustered graph C.
See also
writeDOT(const ClusterGraph &C, std::ostream &os)
Parameters
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readDOT() [2/4]

static bool ogdf::GraphIO::readDOT ( ClusterGraphAttributes A,
ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) with attributes A in DOT format from input stream is.

Precondition
C is the clustered graph associated with attributes A, and G is the graph associated with C.
See also
writeDOT(const ClusterGraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readDOT() [3/4]

static bool ogdf::GraphIO::readDOT ( Graph G,
std::istream &  is 
)
static

Reads graph G in DOT format from input stream is.

See also
writeDOT(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readDOT() [4/4]

static bool ogdf::GraphIO::readDOT ( GraphAttributes A,
Graph G,
std::istream &  is 
)
static

Reads graph G with attributes A in DOT format from input stream is.

Precondition
G is the graph associated with attributes A.
See also
writeDOT(const GraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readEdgeListSubgraph()

static bool ogdf::GraphIO::readEdgeListSubgraph ( Graph G,
List< edge > &  delEdges,
std::istream &  is 
)
static

Reads graph G with subgraph defined by delEdges from stream is.

See also
writeEdgeListSubgraph(const Graph &G, const List<edge> &delEdges, std::ostream &os)
Parameters
Gis assigned the read graph.
delEdgesis assigned the edges of the subgraph.
isis the input stream from which the graph is read.
Returns
true if successful, false otherwise.

◆ readGDF() [1/2]

static bool ogdf::GraphIO::readGDF ( Graph G,
std::istream &  is 
)
static

Reads graph G in GDF format from input stream is.

See also
writeGDF(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGDF() [2/2]

static bool ogdf::GraphIO::readGDF ( GraphAttributes A,
Graph G,
std::istream &  is 
)
static

Reads graph G with attributes A in GDF format from input stream is.

Precondition
G is the graph associated with attributes A.
See also
writeGDF(const GraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGEXF() [1/4]

static bool ogdf::GraphIO::readGEXF ( ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) in GEXF format from input stream is.

Precondition
G is the graph associated with clustered graph C.
See also
writeGEXF(const ClusterGraph &C, std::ostream &os)
Parameters
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGEXF() [2/4]

static bool ogdf::GraphIO::readGEXF ( ClusterGraphAttributes A,
ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) with attributes A in GEXF format from input stream is.

Precondition
C is the clustered graph associated with attributes A, and G is the graph associated with C.
See also
writeGEXF(const ClusterGraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGEXF() [3/4]

static bool ogdf::GraphIO::readGEXF ( Graph G,
std::istream &  is 
)
static

Reads graph G in GEXF format from input stream is.

See also
writeGEXF(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGEXF() [4/4]

static bool ogdf::GraphIO::readGEXF ( GraphAttributes A,
Graph G,
std::istream &  is 
)
static

Reads graph G with attributes A in GEXF format from input stream is.

Precondition
G is the graph associated with attributes A.
See also
writeGEXF(const GraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGML() [1/4]

static bool ogdf::GraphIO::readGML ( ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) in GML format from input stream is.

Precondition
G is the graph associated with clustered graph C.
See also
writeGML(const ClusterGraph &C, std::ostream &os)
Parameters
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGML() [2/4]

static bool ogdf::GraphIO::readGML ( ClusterGraphAttributes A,
ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) with attributes A in GML format from input stream is.

Precondition
C is the clustered graph associated with attributes A, and G is the graph associated with C.
See also
writeGML(const ClusterGraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGML() [3/4]

static bool ogdf::GraphIO::readGML ( Graph G,
std::istream &  is 
)
static

Reads graph G in GML format from input stream is.

The GML (Graph Modelling Language) file format is an Ascii-based format that has been developed by Michael Himsolt at the University of Passau. Its full specification can be found in this technical report.

See also
writeGML(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGML() [4/4]

static bool ogdf::GraphIO::readGML ( GraphAttributes A,
Graph G,
std::istream &  is 
)
static

Reads graph G with attributes A in GML format from input stream is.

Precondition
G is the graph associated with attributes A.
See also
writeGML(const GraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGraph6()

static bool ogdf::GraphIO::readGraph6 ( Graph G,
std::istream &  is,
bool  forceHeader = false 
)
static

Reads graph G in Graph6 format from input stream is.

See also
writeGraph6(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
forceHeaderif the file has to start with '>>graph6<<'.
Returns
true if successful, false otherwise.

◆ readGraphML() [1/4]

static bool ogdf::GraphIO::readGraphML ( ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) in GraphML format from input stream is.

Precondition
G is the graph associated with clustered graph C.
See also
writeGraphML(const ClusterGraph &C, std::ostream &os)
Parameters
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGraphML() [2/4]

static bool ogdf::GraphIO::readGraphML ( ClusterGraphAttributes A,
ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) with attributes A in GraphML format from input stream is.

Precondition
C is the clustered graph associated with attributes A, and G is the graph associated with C.
See also
writeGraphML(const ClusterGraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGraphML() [3/4]

static bool ogdf::GraphIO::readGraphML ( Graph G,
std::istream &  is 
)
static

Reads graph G in GraphML format from input stream is.

See also
writeGraphML(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readGraphML() [4/4]

static bool ogdf::GraphIO::readGraphML ( GraphAttributes A,
Graph G,
std::istream &  is 
)
static

Reads graph G with attributes A in GraphML format from input stream is.

Precondition
G is the graph associated with attributes A.
See also
writeGraphML(const GraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readLEDA()

static bool ogdf::GraphIO::readLEDA ( Graph G,
std::istream &  is 
)
static

Reads graph G in LEDA graph format from input stream is.

The LEDA graph format is a simple, Ascii-based file format used by the LEDA library. Its specification is described in the LEDA Guide.

See also
writeLEDA(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readMatrixMarket()

static bool ogdf::GraphIO::readMatrixMarket ( Graph G,
std::istream &  inStream 
)
static

Reads graph G in Matrix Market exchange format from stream inStream.

Parameters
Gis assigned the read graph.
inStreamis the input stream to read from
Returns
true if successful, false otherwise.

◆ readPLA()

static bool ogdf::GraphIO::readPLA ( Graph G,
List< node > &  hypernodes,
List< edge > *  shell,
std::istream &  is 
)
static

Reads a hypergraph (as point-based expansion) in PLA format from input stream is.

A hypergraph in OGDF is represented by its point-based expansion, i.e., for each hyperedge h we have a corresponding hypernode n. All nodes originally incident to h are incident to n, i.e., have regular edges to n.

Warning
This is a very simple implementation only usable for very properly formatted files!
Parameters
Gis assigned the read graph (point-based expansion of the hypergraph).
hypernodesis assigned the list of nodes which have to be interpreted as hypernodes.
shellif 0 only the PLA-hypergraph is read. Otherwise we extend the graph by a simple edge e=(i,o) and two hyperedges: one hyperedges groups all input nodes and i together, the other hyperedge groups all output edges and o. These additional edges are then also collocated in shell.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readPMDissGraph()

static bool ogdf::GraphIO::readPMDissGraph ( Graph G,
std::istream &  is 
)
static

Reads graph G in a simple format as used in Petra Mutzel's thesis from input stream is.

This simple graph format has a leading line stating the name of the graph and a following line stating the size of the graph:

*BEGIN unknown_name.numN.numE
*GRAPH numN numE UNDIRECTED UNWEIGHTED
See also
writePMDissGraph(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readRome()

static bool ogdf::GraphIO::readRome ( Graph G,
std::istream &  is 
)
static

Reads graph G in Rome-Lib format from input stream is.

The Rome-Lib format contains n "node-lines", 1 "separator-line", m "edge-lines" (in this order). These lines are as follows (whereby all IDs are integer numbers):

  • node-line: NodeId 0
  • separator-line: starts with a #-sign
  • edge-line: EdgeId 0 SourceNodeId TargetNodeId
See also
writeRome(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readRudy() [1/2]

static bool ogdf::GraphIO::readRudy ( Graph G,
std::istream &  is 
)
inlinestatic

Reads graph G in Rudy format from input stream is.

Warning
The edge weights are ignored.
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

Definition at line 924 of file GraphIO.h.

◆ readRudy() [2/2]

static bool ogdf::GraphIO::readRudy ( GraphAttributes A,
Graph G,
std::istream &  is 
)
static

Reads graph G with edge weights stored in A in Rudy format from input stream is.

Precondition
G is the graph associated with attributes A.
See also
writeRudy(const GraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes (only edge weights (as doubles) are used).
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readSparse6()

static bool ogdf::GraphIO::readSparse6 ( Graph G,
std::istream &  is,
bool  forceHeader = false 
)
static

Reads graph G in Sparse6 format from input stream is.

See also
writeSparse6(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
forceHeaderif the file has to start with '>>sparse6<<'.
Returns
true if successful, false otherwise.

◆ readSTP() [1/4]

template<typename T >
static bool ogdf::GraphIO::readSTP ( EdgeWeightedGraph< T > &  wG,
List< node > &  terminals,
NodeArray< bool > &  isTerminal,
std::istream &  is 
)
inlinestatic

Reads a SteinLib instance from an inputstream is and converts it into a weighted graph wG and a set of terminal nodes terminals.

Warning
The coordinate section of the SteinLib instance is not read!
Parameters
wGthe edge weighted graph
terminalswill contain a list of all terminals in the graph, in case of a directed graph the root will be at the lists front position
isTerminalmaps whether each node is a terminal or a Steiner node
isthe input stream to be read
Returns
true if the STP was read successfully, false otherwise

Definition at line 1572 of file GraphIO.h.

◆ readSTP() [2/4]

static bool ogdf::GraphIO::readSTP ( Graph G,
std::istream &  is 
)
inlinestatic

Reads a graph in SteinLib format from std::istream is.

Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

Definition at line 1553 of file GraphIO.h.

◆ readSTP() [3/4]

static bool ogdf::GraphIO::readSTP ( GraphAttributes attr,
Graph G,
List< node > &  terminals,
NodeArray< bool > &  isTerminal,
std::istream &  is 
)
static

Reads a graph in SteinLib format from std::istream is.

Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise. The node shape graph attribute will be set according to the node type: Non-Terminal: Shape::Ellipse, Terminal: Shape::Rectangle, Root (directed STP): Shape::Triangle
Parameters
attrwill contain the weights of the edges, node coordinates and type (encoded in shape as described above) as well as whether the read graph is directed
Precondition
in attr GraphAttributes::intWeight Xor GraphAttributes::doubleWeight has to be set
Parameters
terminalswill contain a list of all terminals in the graph, in case of a directed graph the root will be at the lists front position
isTerminalmaps whether each node is a terminal or a Steiner node

◆ readSTP() [4/4]

static bool ogdf::GraphIO::readSTP ( GraphAttributes attr,
Graph G,
std::istream &  is 
)
inlinestatic

Reads a graph in SteinLib format from std::istream is.

Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise. The node shape graph attribute will be set according to the node type: Non-Terminal: Shape::Ellipse, Terminal: Shape::Rectangle, Root (directed STP): Shape::Triangle
Parameters
attrwill contain the weights of the edges, node coordinates and type (encoded in shape as described above) as well as whether the read graph is directed
Precondition
in attr GraphAttributes::intWeight Xor GraphAttributes::doubleWeight has to be set

Definition at line 1540 of file GraphIO.h.

◆ readTLP() [1/4]

static bool ogdf::GraphIO::readTLP ( ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) in TLP format from input stream is.

Precondition
G is the graph associated with clustered graph C.
See also
writeTLP(const ClusterGraph &C, std::ostream &os)
Parameters
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readTLP() [2/4]

static bool ogdf::GraphIO::readTLP ( ClusterGraphAttributes A,
ClusterGraph C,
Graph G,
std::istream &  is 
)
static

Reads clustered graph (C, G) with attributes A in TLP format from input stream is.

Precondition
C is the clustered graph associated with attributes A, and G is the graph associated with C.
See also
writeTLP(const ClusterGraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Cis assigned the read clustered graph (cluster structure).
Gis assigned the read clustered graph (graph structure).
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readTLP() [3/4]

static bool ogdf::GraphIO::readTLP ( Graph G,
std::istream &  is 
)
static

Reads graph G in TLP format from input stream is.

See also
writeTLP(const Graph &G, std::ostream &os)
Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readTLP() [4/4]

static bool ogdf::GraphIO::readTLP ( GraphAttributes A,
Graph G,
std::istream &  is 
)
static

Reads graph G with attributes A in TLP format from input stream is.

Precondition
G is the graph associated with attributes A.
See also
writeTLP(const GraphAttributes &A, std::ostream &os)
Parameters
Ais assigned the graph's attributes.
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readTsplibXml() [1/2]

static bool ogdf::GraphIO::readTsplibXml ( Graph G,
std::istream &  is 
)
static

Reads graph G in TsplibXml format from input stream is.

Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readTsplibXml() [2/2]

static bool ogdf::GraphIO::readTsplibXml ( GraphAttributes GA,
Graph G,
std::istream &  is 
)
static

Reads graph G with attributes GA in TsplibXml format from input stream is.

Precondition
G is the graph associated with attributes GA.
Parameters
GAis assigned the graph's attributes.
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ readYGraph()

static bool ogdf::GraphIO::readYGraph ( Graph G,
std::istream &  is 
)
static

Reads graph G in Y-graph format from input stream is.

This format is e.g. produced by NAUTY (http://www.cs.sunysb.edu/~algorith/implement/nauty/implement.shtml).

Details on the format, as given in NAUTYs graph generator (see above link): "[A] graph occupies one line with a terminating newline. Except for the newline, each byte has the format 01xxxxxx, where each "x" represents one bit of data.

First byte: xxxxxx is the number of vertices n

Other ceiling(n(n-1)/12) bytes: These contain the upper triangle of the adjacency matrix in column major order. That is, the entries appear in the order (0,1),(0,2),(1,2),(0,3),(1,3),(2,3),(0,4),... . The bits are used in left to right order within each byte. Any unused bits on the end are set to zero.

Parameters
Gis assigned the read graph.
isis the input stream to be read.
Returns
true if successful, false otherwise.

◆ setColorValue()

static bool ogdf::GraphIO::setColorValue ( int  value,
std::function< void(uint8_t)>  setFunction 
)
inlinestatic

Set a color value (R/G/B/A) based on an integer. Checks if the value is in the right range.

Definition at line 1889 of file GraphIO.h.

◆ setIndentChar()

static void ogdf::GraphIO::setIndentChar ( char  c)
inlinestatic

Sets the indentation character to c.

Precondition
c must be a white-space character (e.g., a space or a tab).

Definition at line 1864 of file GraphIO.h.

◆ setIndentWidth()

static void ogdf::GraphIO::setIndentWidth ( int  w)
inlinestatic

Sets the indentation width to w.

Precondition
w must be non-negative. Setting the indentation width to 0 suppresses indentation.

Definition at line 1874 of file GraphIO.h.

◆ write() [1/4]

static bool ogdf::GraphIO::write ( const ClusterGraph CG,
const string &  filename,
ClusterWriterFunc  writer = nullptr 
)
static

Writes graph G and a clustering CG of G to a file with name filename and infers the format to use from the file's extension.

Parameters
CGits clusters
filenamethe file
writerformat to be used (e.g. writeGML), use nullptr (the default) for automated detection from filename extension
Returns
true if successful, false otherwise.

◆ write() [2/4]

static bool ogdf::GraphIO::write ( const ClusterGraphAttributes GA,
const string &  filename,
ClusterAttrWriterFunc  writer = nullptr 
)
static

Writes graph G, a clustering CG of G and their attributes CGA to a file with name filename and infers the format to use from the file's extension.

Parameters
GAtheir attributes
filenamethe file
writerformat to be used (e.g. writeGML), use nullptr (the default) for automated detection from filename extension
Returns
true if successful, false otherwise.

◆ write() [3/4]

static bool ogdf::GraphIO::write ( const Graph G,
const string &  filename,
WriterFunc  writer = nullptr 
)
static

Writes graph G to a file with name filename and infers the format to use from the file's extension.

Parameters
Gthe Graph
filenamethe file
writerformat to be used (e.g. writeGML), use nullptr (the default) for automated detection from filename extension
Returns
true if successful, false otherwise.

◆ write() [4/4]

static bool ogdf::GraphIO::write ( const GraphAttributes GA,
const string &  filename,
AttrWriterFunc  writer = nullptr 
)
static

Writes graph G and its attributes GA to a file with name filename and infers the format to use from the file's extension.

Parameters
GAits attributes
filenamethe file
writerformat to be used (e.g. writeGML), use nullptr (the default) for automated detection from filename extension
Returns
true if successful, false otherwise.

◆ writeChaco()

static bool ogdf::GraphIO::writeChaco ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in Chaco format to output stream os.

This simple graph format is used by graph partitioning tools like Chaco, Metis, or Jostle. Its specification is described in the Jostle User Guide.

See also
readChaco(Graph &G, std::istream &is)
Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeChallengeGraph()

static bool ogdf::GraphIO::writeChallengeGraph ( const Graph G,
const GridLayout gl,
std::ostream &  os 
)
static

Writes graph G with grid layout gl in GD-Challenge-format to output stream os.

Precondition
G is the graph associated with grid layout gl.
See also
readChallengeGraph(Graph &G, GridLayout &gl, std::istream &is)
Parameters
Gis the graph to be written.
glspecifies the grid layout of G to be written.
osis the output stream to which the graph is written.
Returns
true if successful, false otherwise.

◆ writeDigraph6()

static bool ogdf::GraphIO::writeDigraph6 ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in Digraph6 format to output stream os.

See also
readDigraph6(Graph &G, std::istream &is)
Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeDL() [1/2]

static bool ogdf::GraphIO::writeDL ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in DL format to output stream os.

Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeDL() [2/2]

static bool ogdf::GraphIO::writeDL ( const GraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in DL format to output stream os.

Parameters
Aspecifies the graph and its attributes to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeDMF() [1/2]

template<typename T >
static bool ogdf::GraphIO::writeDMF ( const Graph graph,
const EdgeArray< T > &  weights,
const node  source,
const node  sink,
std::ostream &  os 
)
inlinestatic

Writes a maximum flow problem instance to a DIMACS maximum flow file.

Parameters
graphgraph to be written
weightscontains the weights of the edges
sourcesource of the maximum flow
sinksink of the maximum flow
osthe output stream be written to
Returns
true if the write operation succeeded, false otherwise

Definition at line 1725 of file GraphIO.h.

◆ writeDMF() [2/2]

static bool ogdf::GraphIO::writeDMF ( const GraphAttributes attr,
const node  source,
const node  sink,
std::ostream &  os 
)
static

Writes a maximum flow problem instance to a DIMACS maximum flow file.

Double edge weights will be preferred to integer edge weights if both GraphAttributes::intWeight and GraphAttributes::doubleWeight are set.

Parameters
attrcontains the graph as well as its edge weights
sourcesource of the maximum flow
sinksink of the maximum flow
osthe output stream be written to
Returns
true if the write operation succeeded, false otherwise

◆ writeDOT() [1/4]

static bool ogdf::GraphIO::writeDOT ( const ClusterGraph C,
std::ostream &  os 
)
static

Writes clustered graph C in DOT format to output stream os.

Parameters
Cis the clustered graph to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeDOT() [2/4]

static bool ogdf::GraphIO::writeDOT ( const ClusterGraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in DOT format to output stream os.

Parameters
Aspecifies the clustered graph and its attributes to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeDOT() [3/4]

static bool ogdf::GraphIO::writeDOT ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in DOT format to output stream os.

Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeDOT() [4/4]

static bool ogdf::GraphIO::writeDOT ( const GraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in DOT format to output stream os.

Parameters
Aspecifies the graph and its attributes to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeEdgeListSubgraph()

static bool ogdf::GraphIO::writeEdgeListSubgraph ( const Graph G,
const List< edge > &  delEdges,
std::ostream &  os 
)
static

Writes graph G with subgraph defined by delEdges to stream os.

See also
readEdgeListSubgraph(Graph &G, List<edge> &delEdges, std::istream &is)
Parameters
Gis the graph to be written.
delEdgesspecifies the edges of the subgraph to be stored.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGDF() [1/2]

static bool ogdf::GraphIO::writeGDF ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in GDF format to output stream os.

Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGDF() [2/2]

static bool ogdf::GraphIO::writeGDF ( const GraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in GDF format to output stream os.

Parameters
Aspecifies the graph and its attributes to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGEXF() [1/4]

static bool ogdf::GraphIO::writeGEXF ( const ClusterGraph C,
std::ostream &  os 
)
static

Writes clustered graph C in GEXF format to output stream os.

Parameters
Cis the clustered graph to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeGEXF() [2/4]

static bool ogdf::GraphIO::writeGEXF ( const ClusterGraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in GEXF format to output stream os.

Parameters
Aspecifies the clustered graph and its attributes to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeGEXF() [3/4]

static bool ogdf::GraphIO::writeGEXF ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in GEXF format to output stream os.

Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGEXF() [4/4]

static bool ogdf::GraphIO::writeGEXF ( const GraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in GEXF format to output stream os.

Parameters
Aspecifies the graph and its attributes to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGML() [1/4]

static bool ogdf::GraphIO::writeGML ( const ClusterGraph C,
std::ostream &  os 
)
static

Writes clustered graph C in GML format to output stream os.

See also
readGML(ClusterGraph &C, Graph &G, std::istream &is)
Parameters
Cis the clustered graph to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeGML() [2/4]

static bool ogdf::GraphIO::writeGML ( const ClusterGraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in GML format to output stream os.

See also
readGML(ClusterGraphAttributes &A, ClusterGraph &C, Graph &G, std::istream &is)
Parameters
Aspecifies the clustered graph and its attributes to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeGML() [3/4]

static bool ogdf::GraphIO::writeGML ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in GML format to output stream os.

The GML (Graph Modelling Language) file format is an Ascii-based format that has been developed by Michael Himsolt at the University of Passau. Its full specification can be found in this technical report. The GML format stores the basic graph structure, i.e., nodes and edges.

See also
readGML(Graph &G, std::istream &is)
Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGML() [4/4]

static bool ogdf::GraphIO::writeGML ( const GraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in GML format to output stream os.

See also
readGML(GraphAttributes &A, Graph &G, std::istream &is)
Parameters
Aspecifies the graph and its attributes to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGraph6()

static bool ogdf::GraphIO::writeGraph6 ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in Graph6 format to output stream os.

See also
readGraph6(Graph &G, std::istream &is)
Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGraphML() [1/4]

static bool ogdf::GraphIO::writeGraphML ( const ClusterGraph C,
std::ostream &  os 
)
static

Writes clustered graph C in GraphML format to output stream os.

Parameters
Cis the clustered graph to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeGraphML() [2/4]

static bool ogdf::GraphIO::writeGraphML ( const ClusterGraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in GraphML format to output stream os.

Parameters
Aspecifies the clustered graph and its attributes to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeGraphML() [3/4]

static bool ogdf::GraphIO::writeGraphML ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in GraphML format to output stream os.

Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeGraphML() [4/4]

static bool ogdf::GraphIO::writeGraphML ( const GraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in GraphML format to output stream os.

Parameters
Aspecifies the graph and its attributes to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeLEDA()

static bool ogdf::GraphIO::writeLEDA ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in LEDA graph format to output stream os.

The LEDA graph format is a simple, Ascii-based file format used by the LEDA library. Its specification is described in the LEDA Guide.

See also
readLEDA(Graph &G, std::istream &is)
Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writePMDissGraph()

static bool ogdf::GraphIO::writePMDissGraph ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in a simple format as used in Petra Mutzel's thesis to output stream os.

This simple graph format has a leading line stating the name of the graph and a following line stating the size of the graph:

*BEGIN unknown_name.numN.numE
*GRAPH numN numE UNDIRECTED UNWEIGHTED
See also
readPMDissGraph(Graph &G, std::istream &is)
Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeRome()

static bool ogdf::GraphIO::writeRome ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in Rome-Lib format to output stream os.

See also
readRome(Graph &G, std::istream &is) for more details about the format.
Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeRudy()

static bool ogdf::GraphIO::writeRudy ( const GraphAttributes A,
std::ostream &  os 
)
static

Writes graph with edge weights stored in A in Rudy format to output stream os.

See also
readRudy(GraphAttributes &A, Graph &G, std::istream &is)
Parameters
Aspecifies the graph and its attributes to be written (only edge weights (as doubles) are stored in this format).
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeSparse6()

static bool ogdf::GraphIO::writeSparse6 ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in Sparse6 format to output stream os.

See also
readSparse6(Graph &G, std::istream &is)
Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeSTP() [1/2]

template<typename T >
static bool ogdf::GraphIO::writeSTP ( const EdgeWeightedGraph< T > &  wG,
const List< node > &  terminals,
std::ostream &  os,
const string &  comments = "" 
)
inlinestatic

Writes an Steiner problem instance to an STP file.

Parameters
wGthe edge weighted graph
terminalsa list of all terminals in the graph, in the case of a directed graph, the root needs to be the front element
osthe output stream be written to
commentsa string containing all comments seperated by LF if this is an empty string no comment section will be created
Returns
true if the write operation succeeded, false otherwise

Definition at line 1616 of file GraphIO.h.

◆ writeSTP() [2/2]

static bool ogdf::GraphIO::writeSTP ( const GraphAttributes attr,
const List< node > &  terminals,
std::ostream &  os,
const string &  comments = "" 
)
static

Writes an Steiner problem instance to an STP file.

Double edge weights will be preferred to integer edge weights if both GraphAttributes::intWeight and GraphAttributes::doubleWeight are set.

Parameters
attrcontains the graph as well as its edge weights, node coordinates (if GraphAttributes::nodeGraphics is enabled) and whether the graph is directed
terminalsa list of all terminals in the graph, in the case of a directed graph, the root needs to be the front element
osthe output stream be written to
commentsa string containing all comments seperated by LF if this is an empty string no comment section will be created
Returns
true if the write operation succeeded, false otherwise

◆ writeTLP() [1/4]

static bool ogdf::GraphIO::writeTLP ( const ClusterGraph C,
std::ostream &  os 
)
static

Writes clustered graph C in TLP format to output stream os.

Parameters
Cis the clustered graph to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeTLP() [2/4]

static bool ogdf::GraphIO::writeTLP ( const ClusterGraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in TLP format to output stream os.

Parameters
Aspecifies the clustered graph and its attributes to be written.
osis the output stream to which the clustered graph will be written.
Returns
true if successful, false otherwise.

◆ writeTLP() [3/4]

static bool ogdf::GraphIO::writeTLP ( const Graph G,
std::ostream &  os 
)
static

Writes graph G in TLP format to output stream os.

Parameters
Gis the graph to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

◆ writeTLP() [4/4]

static bool ogdf::GraphIO::writeTLP ( const GraphAttributes A,
std::ostream &  os 
)
static

Writes graph with attributes A in TLP format to output stream os.

Parameters
Aspecifies the graph and its attributes to be written.
osis the output stream to which the graph will be written.
Returns
true if successful, false otherwise.

Member Data Documentation

◆ FILE_TYPE_MAP

std::unordered_map<string, const FileType*> ogdf::GraphIO::FILE_TYPE_MAP
static

Definition at line 121 of file GraphIO.h.

◆ FILE_TYPES

const std::vector<FileType> ogdf::GraphIO::FILE_TYPES
static

Definition at line 120 of file GraphIO.h.

◆ logger

Logger ogdf::GraphIO::logger
static

Definition at line 64 of file GraphIO.h.

◆ s_indentChar

char ogdf::GraphIO::s_indentChar
staticprivate

Character used for indentation.

Definition at line 1943 of file GraphIO.h.

◆ s_indentWidth

int ogdf::GraphIO::s_indentWidth
staticprivate

Number of indent characters used for indentation.

Definition at line 1944 of file GraphIO.h.

◆ svgSettings

SVGSettings ogdf::GraphIO::svgSettings
static

Definition at line 1940 of file GraphIO.h.


The documentation for this class was generated from the following file: