GraphML Specification

Home Download Specification Examples About
File Format Links
GXL - an XML-based graph exchange format developed for software re-engineering.

GML - a widely used graph exchange format (non-XML).

XGMML - an XML-based file format for graphs based on GML.

SVG - an XML-based graphics format.

Graph Drawing Links - home of graph drawing

GD 2010 - 18th Intl. Symp. Graph Drawing, 21-24 Sep 2010, Konstanz, Germany

XML Links
XML - home of the Extensible Markup Language at the World Wide Web Consortium.


This document specifies syntax and processing rules for the GraphML language core (structural layer) and two GraphML extensions that allow to add base-type attributes and parsing information. While a more comprehensive introduction can be found here, some background on the design of GraphML is provided in the following reference:

U. Brandes, M. Eiglsperger, I. Herman, M. Himsolt, and M.S. Marshall:
GraphML Progress Report: Structural Layer Proposal.
Proc. 9th Intl. Symp. Graph Drawing (GD '01), LNCS 2265, pp. 501-512.
© Springer-Verlag, 2002.


The GraphML syntax is defined by the GraphML Schema. While this is the binding definition, we also provide a looser specfication in the GraphML Document Type Definition (DTD), which, e.g., does not distinguish reference types like node and edge IDs. Nevertheless, some applications may need a DTD to work properly.

GraphML Schema GraphML DTD

Processing Rules

Elements an application can't handle are ignored, i.e. a GraphML document is interpreted as if consisting only of those elements known and visible to the application. In particular:

  • The elements <port>, <hyperedge>, <endpoint>, and <locator> are simply ignored by applications not knowing some, or all of them. The parser may give a warning that an unknown element has been encountered.
  • There is no canonical way how applications, capable of handling only one <graph> per document, should handle the case of several <graph>s. So, these applications can choose, either processing only the first <graph>, or taking the union of all <graph>s in the document, or using another fallback policy. In either case, these applications must give a warning and inform the user.
  • There is no canonical way how applications, not capable of handling nested <graph>s, should deal with a document using this feature. So, these applications can choose, either ignoring all graph information in deeper levels, or lifting deeper levels to the top level, or using another fallback policy. In either case, these applications must give a warning and inform the user.

Additional Data

GraphML provide a mechanism to add data to the structural elements (e.g. <graph>s, <node>s, <edge>s, etc.). Data labellings are considered to be (possibly partial) functions that assign values in an (a priori) arbitrary range to elements of the graph. Such a function is declared by a <key> element. The domain of definition of this function is specified by the 'for' attribute of the <key>. Values are defined by a <default> element (child of <key>) and/or <data> elements (children of the elements, which are in the domain of definition) whose 'key' attribute-values matches the 'id' of the <key>.

Typed Data

The attribute extension allows specification of the range of values of the abovementioned data functions. It does so by the additional attribute 'attr.type' of <key>. Values of this attribute ('boolean', 'int', 'long', 'float', 'double', and 'string') specify how to interpret the charakter strings within <data> and <default> elements.

Furthermore an attribute '' is added to <key> which may be used by applications to identify their data.

Information for Parsers

The parseinfo extension adds several attributes to <graph>s and <node>s which help parsers to process a document more efficiently. These attributes specify for instance the number of <node>s or <edge>s, degrees of nodes, maximal/minimal degree and more.

User-defined Extensions

GraphML can be extended in two ways:

  • Users can add structured content to the elements <data> and <default>.
  • Users can add attributes to all GraphML elements.

How this can be done will be explained in a more comprehensive introduction which is being prepared.

05 April 2007
Licensing status clarified: GraphML is free for everyone.
22 February 2007
GraphML 1.0 schema inclusion altered to avoid problems with some parsers.
03 August 2004
LEDA extension package for GraphML (release candidate).
01 June 2004
GraphML Primer released.
18 March 2003
XML Schema specification and documentation available for GraphML 1.0rc (release candidate)
23 July 2002
GraphML presentation at the annual meeting of DFG Research Priority 1126 Algorithmic Aspects of Large and Complex Networks. (ps, pdf)
28 June 2002
yFiles extension package for GraphML version 1.0 released.
22 May 2002
Release candidates for extensions graphml-attributes (for data attributes) and graphml-parseinfo (for lightweight parsers) completed. See current specification.
12 March 2002
GraphML proposed as the standard format for the network data archive to be created within EU FET Open Project COSIN.

Valid HTML 4.01!

Last update: Tuesday, 15-Dec-2009 13:11:32 CET