Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
GraphMLParser.h
Go to the documentation of this file.
1
32#pragma once
33
36
38
39#include <sstream>
40#include <unordered_map>
41
42namespace ogdf {
43
45private:
47 pugi::xml_node m_graphTag; // "Almost root" tag.
48
49 // Maps GraphML node id to Graph node.
50 std::unordered_map<string, node> m_nodeId;
51
52 // Maps attribute id to its name.
53 std::unordered_map<string, string> m_attrName;
54
58
59 // Finds all data-keys for given element and calls appropiate "readData".
60 template<typename A, typename T>
61 bool readAttributes(A& GA, const T& elem, const pugi::xml_node xmlElem) {
62 for (pugi::xml_node dataTag : xmlElem.children("data")) {
63 const bool result = readData(GA, elem, dataTag);
64 if (!result) {
65 return false;
66 }
67 }
68
69 return true;
70 }
71
75 const cluster& rootCluster, const pugi::xml_node clusterRoot);
76
77 bool m_error;
78
79public:
80 explicit GraphMLParser(std::istream& in);
82
83 bool read(Graph& G);
85 bool read(Graph& G, ClusterGraph& C);
87};
88
89}
Declares class GraphIO which provides access to all graph read and write functionality.
Declaration and implementation of HashArray class.
Representation of clusters in a clustered graph.
Stores additional attributes of a clustered graph (like layout information).
Representation of clustered graphs.
Class for the representation of edges.
Definition Graph_d.h:300
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
std::unordered_map< string, node > m_nodeId
bool read(Graph &G, ClusterGraph &C, ClusterGraphAttributes &CA)
bool readNodes(Graph &G, GraphAttributes *GA, const pugi::xml_node rootTag)
bool read(Graph &G, ClusterGraph &C)
bool readData(ClusterGraphAttributes &CA, const cluster &c, const pugi::xml_node clusterData)
pugi::xml_document m_xml
GraphMLParser(std::istream &in)
std::unordered_map< string, string > m_attrName
bool readAttributes(A &GA, const T &elem, const pugi::xml_node xmlElem)
pugi::xml_node m_graphTag
bool read(Graph &G)
bool readEdges(Graph &G, GraphAttributes *GA, const pugi::xml_node rootTag)
bool read(Graph &G, GraphAttributes &GA)
bool readClusters(Graph &G, ClusterGraph &C, ClusterGraphAttributes *CA, const cluster &rootCluster, const pugi::xml_node clusterRoot)
bool readData(GraphAttributes &GA, const edge &e, const pugi::xml_node edgeData)
bool readData(GraphAttributes &GA, const node &v, const pugi::xml_node nodeData)
Class for the representation of nodes.
Definition Graph_d.h:177
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.