Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

GdfParser.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/HashArray.h>
37 #include <ogdf/fileformats/GDF.h>
38 
39 #include <istream>
40 #include <sstream>
41 #include <string>
42 #include <vector>
43 
44 namespace ogdf {
45 
46 namespace gdf {
47 
48 
49 class Parser {
50 private:
51  std::istream& m_istream;
53  std::vector<NodeAttribute> m_nodeAttrs;
54  std::vector<EdgeAttribute> m_edgeAttrs;
55 
56  bool readAttributes(GraphAttributes& GA, node v, const std::vector<std::string>& values);
57  bool readAttributes(GraphAttributes& GA, edge e, const std::vector<std::string>& values);
58 
59  bool readNodeDef(const std::string& str);
60  bool readEdgeDef(const std::string& str);
61 
62  bool readNodeStmt(Graph& G, GraphAttributes* GA, const std::string& str, size_t line);
63  bool readEdgeStmt(Graph& G, GraphAttributes* GA, const std::string& str, size_t line);
64 
65  bool readGraph(Graph& G, GraphAttributes* GA);
66 
67 public:
68  explicit Parser(std::istream& is);
69 
70  bool read(Graph& G) { return readGraph(G, nullptr); }
71 
72  bool read(Graph& G, GraphAttributes& GA) { return readGraph(G, &GA); }
73 };
74 
75 }
76 }
HashArray.h
Declaration and implementation of HashArray class.
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Graph.h
Includes declaration of graph class.
GDF.h
Declarations for GDF file format.
ogdf::gdf::Parser::readAttributes
bool readAttributes(GraphAttributes &GA, node v, const std::vector< std::string > &values)
ogdf::gdf::Parser::readGraph
bool readGraph(Graph &G, GraphAttributes *GA)
ogdf::gdf::Parser::readEdgeStmt
bool readEdgeStmt(Graph &G, GraphAttributes *GA, const std::string &str, size_t line)
ogdf::gdf::Parser::m_nodeId
HashArray< std::string, node > m_nodeId
Definition: GdfParser.h:52
ogdf::gdf::Parser::m_edgeAttrs
std::vector< EdgeAttribute > m_edgeAttrs
Definition: GdfParser.h:54
ogdf::gdf::Parser::m_istream
std::istream & m_istream
Definition: GdfParser.h:51
ogdf::HashArray
Indexed arrays using hashing for element access.
Definition: HashArray.h:93
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::gdf::Parser::m_nodeAttrs
std::vector< NodeAttribute > m_nodeAttrs
Definition: GdfParser.h:53
ogdf::gdf::Parser::Parser
Parser(std::istream &is)
ogdf::gdf::Parser::read
bool read(Graph &G, GraphAttributes &GA)
Definition: GdfParser.h:72
ogdf::gdf::Parser::readNodeDef
bool readNodeDef(const std::string &str)
ogdf::gdf::Parser::readEdgeDef
bool readEdgeDef(const std::string &str)
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::gdf::Parser::read
bool read(Graph &G)
Definition: GdfParser.h:70
ogdf::gdf::Parser
Definition: GdfParser.h:49
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::gdf::Parser::readNodeStmt
bool readNodeStmt(Graph &G, GraphAttributes *GA, const std::string &str, size_t line)