Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

GexfParser.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
39 
40 #include <unordered_map>
41 #include <memory>
42 #include <sstream>
43 
44 
45 namespace ogdf {
46 
47 namespace gexf {
48 
49 
50 class Parser {
51 private:
52  std::istream &m_is;
53 
56 
57  std::unordered_map<std::string, node> m_nodeId;
58  std::unordered_map<std::string, cluster> m_clusterId;
59 
60  std::unordered_map<std::string, std::string> m_nodeAttr, m_edgeAttr;
61 
62  bool init();
63  bool readNodes(Graph &G, GraphAttributes *GA);
64  bool readEdges(Graph &G, ClusterGraph *C, GraphAttributes *GA);
65  bool readCluster(
67  cluster rootCluster,
68  const pugi::xml_node rootTag);
69  bool readAttributes(
70  GraphAttributes &GA, node v,
71  const pugi::xml_node nodeTag);
72  bool readAttributes(
73  GraphAttributes &GA, edge e,
74  const pugi::xml_node edgeTag);
75 
76  static void error(const pugi::xml_node tag, const std::string &msg);
77 
78 public:
79  explicit Parser(std::istream &is);
80 
81  bool read(Graph &G);
82  bool read(Graph &G, GraphAttributes &GA);
83  bool read(Graph &G, ClusterGraph &C);
85 };
86 
87 }
88 }
ogdf::gexf::Parser::readAttributes
bool readAttributes(GraphAttributes &GA, node v, const pugi::xml_node nodeTag)
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:67
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
ogdf::gexf::Parser
Definition: GexfParser.h:50
ogdf::gexf::Parser::init
bool init()
Graph.h
Includes declaration of graph class.
ogdf::gexf::Parser::m_graphTag
pugi::xml_node m_graphTag
Definition: GexfParser.h:55
ogdf::gexf::Parser::read
bool read(Graph &G)
pugixml.h
ogdf::gexf::Parser::m_nodeId
std::unordered_map< std::string, node > m_nodeId
Definition: GexfParser.h:57
ogdf::gexf::Parser::readCluster
bool readCluster(Graph &G, ClusterGraph &C, ClusterGraphAttributes *CA, cluster rootCluster, const pugi::xml_node rootTag)
ogdf::gexf::Parser::m_nodeAttr
std::unordered_map< std::string, std::string > m_nodeAttr
Definition: GexfParser.h:60
ogdf::gexf::Parser::readNodes
bool readNodes(Graph &G, GraphAttributes *GA)
ogdf::ClusterElement
Representation of clusters in a clustered graph.
Definition: ClusterGraph.h:53
ogdf::ClusterGraphAttributes
Stores additional attributes of a clustered graph (like layout information).
Definition: ClusterGraphAttributes.h:47
ogdf::gexf::Parser::m_edgesTag
pugi::xml_node m_edgesTag
Definition: GexfParser.h:55
ogdf::gexf::Parser::m_edgeAttr
std::unordered_map< std::string, std::string > m_edgeAttr
Definition: GexfParser.h:60
pugi::xml_node
Definition: pugixml.h:401
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:495
ogdf::gexf::Parser::m_clusterId
std::unordered_map< std::string, cluster > m_clusterId
Definition: GexfParser.h:58
ogdf::gexf::Parser::readEdges
bool readEdges(Graph &G, ClusterGraph *C, GraphAttributes *GA)
ogdf::gexf::Parser::Parser
Parser(std::istream &is)
ogdf::gexf::Parser::error
static void error(const pugi::xml_node tag, const std::string &msg)
ogdf::gexf::Parser::m_nodesTag
pugi::xml_node m_nodesTag
Definition: GexfParser.h:55
pugi::xml_document
Definition: pugixml.h:943
ClusterGraphAttributes.h
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:292
ClusterGraph.h
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
ogdf::gexf::Parser::m_is
std::istream & m_is
Definition: GexfParser.h:52
ogdf::gexf::Parser::m_xml
pugi::xml_document m_xml
Definition: GexfParser.h:54
ogdf::ClusterGraph
Representation of clustered graphs.
Definition: ClusterGraph.h:291
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:169