PGX 20.1.1

XML-based Formats

Graph ML

PGX supports loading graphs from files using the XML-based GraphML format. Graphs already in memory may also be exported into GraphML files. For a detailed description of the XML schema, please consult the GraphML specification.

PGX GraphML Limitation

Note that 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 typde of vertex (edge) properties
  • port, default, and hyperedge are not supported


The example graph below 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="">
    <key"number" attr.type="integer" for="node" id="number"/>
    <key"label" attr.type="string" for="edge" id="label"/>
    <graph edgedefault="directed">
        <node id="1">
            <data key="number">2</data>
        <node id="2">
            <data key="number">45</data>
        <node id="3">
            <data key="number">83</data>
        <edge target="2" source="1">
            <data key="label">this graph</data>
        <edge source="3" target="2">
            <data key="label">forms a</data>
        <edge target="1" source="3">
            <data key="label">triangle</data>

The image below shows a visualization of this graph:


Please be aware that because of the verbose nature of XML, the GraphML format comes with a large overhead compared to other file-based graph formats. If load/store performance and file size are important factors for you, consider using a different format.