# GraphML

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/GraphML
> Markdown URL: https://mediated.wiki/source/GraphML.md
> Source: https://en.wikipedia.org/wiki/GraphML
> Source revision: 1306890197
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|File format for graphs}}
{{Distinguish|Graph Modelling Language}}
{{Infobox file format
| name = GraphML
| icon = 
| iconcaption = 
| icon_size = 
| screenshot = 
| screenshot_size = 
| caption = 
|_noextcode = 
| extension =               <!-- or: | extensions = -->
|_nomimecode = 
| mime = 
| type code = 
| uniform_type = 
| conforms_to = 
| magic = 
| developer = [http://graphdrawing.org/ Graph Drawing]
| released =                <!-- {{start date and age|YYYY|mm|dd|df=yes/no}} -->
| latest_release_version = 
| latest_release_date =     <!-- {{start date and age|YYYY|mm|dd|df=yes/no}} -->
| genre = [Graph description language](/source/Graph_description_language)
| container_for = 
| contained_by = 
| extended_from = 
| extended_to = 
| standard =                <!-- or: | standards = -->
| free = 
| url = {{URL|http://graphml.graphdrawing.org/}}
}}

'''GraphML''' is an [XML](/source/XML)-based file format for [graphs](/source/Graph_(discrete_mathematics)). The GraphML file format results from the joint effort of the [graph drawing](/source/graph_drawing) community to define a common format for exchanging graph structure data. It uses an XML-based syntax and supports the entire range of possible graph structure constellations including directed, undirected, [mixed graph](/source/mixed_graph)s, [hypergraph](/source/hypergraph)s, and application-specific attributes.<ref>{{Cite book|contribution=Graph Markup Language (GraphML)|first1=Ulrik|last1=Brandes|author1-link=Ulrik Brandes|first2=Markus|last2=Eiglsperger|first3=Jürgen|last3=Lerner|first4=Christian|last4=Pich|url=https://cs.brown.edu/people/rtamassi/gdhandbook/chapters/graphml.pdf|pages=517–541|editor-first=Roberto|editor-last=Tamassia|editor-link=Roberto Tamassia|title=Handbook of Graph Drawing and Visualization|publisher=CRC Press}}.</ref>

==Overview==
A GraphML file consists of an XML file containing a <code>graph</code> element, within which is an unordered sequence of <code>node</code> and <code>edge</code> elements. Each <code>node</code> element should have a distinct <code>id</code> attribute, and each <code>edge</code> element has <code>source</code> and <code>target</code> attributes that identify the endpoints of an edge by having the same value as the <code>id</code> attributes of those endpoints.
Here is what a simple undirected graph with two nodes and one edge between them looks like:
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G" edgedefault="undirected">
    <node id="n0"/>
    <node id="n1"/>
    <edge id="e1" source="n0" target="n1"/>
  </graph>
</graphml>
</syntaxhighlight>

Additional features of the GraphML language allow its users to specify whether edges are directed or undirected, and to associate additional data with vertices or edges.

==See also==
*[yEd](/source/yEd), a widespread graph editor that uses GraphML as its native file format (but ports, hypergraphs not supported and limited nested graphs support).
*[Gephi](/source/Gephi), a graph visualization software that supports a limited set of GraphML.
*[DOT (graph description language)](/source/DOT_(graph_description_language))
*[Boost libraries](/source/Boost_(C%2B%2B_libraries)) allow to read from and write to GraphML format.

==References==
{{reflist}}

==External links==
*{{Official}}
*[http://graphml.graphdrawing.org/primer/graphml-primer.html GraphML Primer]
*[https://web.archive.org/web/20190814062720/http://www.svgopen.org/2003/papers/ComparisonXML2SVGTransformationMechanisms/ Comparison between XML to SVG Transformation Mechanisms], showing conversions between GraphML and [SVG](/source/Scalable_Vector_Graphics)

{{Graph representations}}
Category:XML markup languages
Category:Graph description languages
Category:XML-based_standards

---
Adapted from the Wikipedia article [GraphML](https://en.wikipedia.org/wiki/GraphML) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/GraphML?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
