28.1.5 XML File Formats
Graph ML
Note:
XML-based Graph ML format is deprecated.The graph server (PGX) supports loading graphs from files using the XML-based Graph ML format. Graphs already in memory may also be exported into GraphML files. See GraphML specification for a detailed description of the XML schema.
PGX GraphML Limitation
PGX does not support all features of the GraphML format. Some of the limitations are:
- If the graph is undirected (
edgedefault="undirected"
), then edge properties are not supported - All vertices (edges) must have the same amount and type of vertex (edge) properties
port
,default
, andhyperedge
are not supported
Example 28-6
The following example graph consists of 3 vertices and 3 edges. Each vertex has an integer property named number
and each edge has a string property named label
. Note that the edges are directed and that the strings for the property do not have to be put in (double) quotation marks.
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns">
<key attr.name="number" attr.type="integer" for="node" id="number"/>
<key attr.name="label" attr.type="string" for="edge" id="label"/>
<graph edgedefault="directed">
<node id="1">
<data key="number">2</data>
</node>
<node id="2">
<data key="number">45</data>
</node>
<node id="3">
<data key="number">83</data>
</node>
<edge target="2" source="1">
<data key="label">this graph</data>
</edge>
<edge source="3" target="2">
<data key="label">forms a</data>
</edge>
<edge target="1" source="3">
<data key="label">triangle</data>
</edge>
</graph>
</graphml>
Caution:
Due to the verbose nature of XML, the GraphML format comes with a large overhead compared to other file-based graph formats. You must use a different format if you want to consider the load or store performance and file size as important factors.
Parent topic: Loading Graph Data from Files