Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • System Modeler

    Multidomain modeling and simulation of complex systems

  • Compute ServicesUse with Mathematica and Wolfram|One
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Wolfram|Alpha

  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs

AI Products

  • Wolfram AI Ecosystem
  • Wolfram Foundation Tool
  • Wolfram Cloud MCP
  • Wolfram Local MCP
  • Agent One API
  • CAG Component APIs

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • Linguistic Understanding

Additional Deployment Options

  • Wolfram Cloud
  • Wolfram Web Engine
  • wolframscript
  • WSTPServer
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

Wolfram Consulting

Data Science, Finance & Business

  • Artificial Intelligence
  • Data Science
  • Healthcare
  • Real Estate

Engineering

  • Civil Engineering
  • Automotive Engineering
  • Sustainable Energy

Science & Technology

  • AgTech
  • Biosciences
  • Environmental Science
  • Food Science
  • Quantum Computation
  • Social and Behavioral Sciences

More Wolfram Solutions

Technology for Education

  • Research Universities
  • Colleges & Teaching Universities
  • High Schools
  • Resources for Students

Education Initiatives

  • Next-Gen EdTech
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
For AIs
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • System Modeler
    • Compute ServicesUse with Mathematica and Wolfram|One
    • AI AccessUse with Mathematica and Wolfram|One
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Wolfram|Alpha
      • Wolfram|Alpha Website
      • Wolfram|Alpha APIs
    • AI Products
      • Wolfram AI Ecosystem
      • Wolfram Foundation Tool
      • Wolfram Cloud MCP
      • Wolfram Local MCP
      • Agent One API
      • CAG Component APIs
    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • Linguistic Understanding
    • Additional Deployment Options
      • Wolfram Cloud
      • Wolfram Web Engine
      • wolframscript
      • WSTPServer
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions
    • Wolfram Consulting

    Data Science, Finance & Business

    • Artificial Intelligence
    • Data Science
    • Healthcare
    • Real Estate

    Engineering

    • Civil Engineering
    • Automotive Engineering
    • Sustainable Energy

    Science & Technology

    • AgTech
    • Biosciences
    • Environmental Science
    • Food Science
    • Quantum Computation
    • Social and Behavioral Sciences

    More Wolfram Solutions

    Technology for Education

    • Research Universities
    • Colleges & Teaching Universities
    • High Schools
    • Resources for Students

    Education Initiatives

    • Next-Gen EdTech
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • For AIs
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
GraphML (.graphml)
  • See Also
    • Import
    • Export
    • CloudExport
    • CloudImport

    • Formats
    • Graph6
    • GXL
    • DOT
  • Related Guides
    • Importing & Exporting
    • Listing of All Formats
    • Mathematical Data
    • Mathematical Data Formats
    • See Also
      • Import
      • Export
      • CloudExport
      • CloudImport

      • Formats
      • Graph6
      • GXL
      • DOT
    • Related Guides
      • Importing & Exporting
      • Listing of All Formats
      • Mathematical Data
      • Mathematical Data Formats
IMPORT/EXPORT FORMAT
  • See Also
    • Import
    • Export
    • CloudExport
    • CloudImport

    • Formats
    • Graph6
    • GXL
    • DOT
  • Related Guides
    • Importing & Exporting
    • Listing of All Formats
    • Mathematical Data
    • Mathematical Data Formats
    • See Also
      • Import
      • Export
      • CloudExport
      • CloudImport

      • Formats
      • Graph6
      • GXL
      • DOT
    • Related Guides
      • Importing & Exporting
      • Listing of All Formats
      • Mathematical Data
      • Mathematical Data Formats

GraphML (.graphml)

  • Import and Export fully support the GraphML format.

Background & Context

    • GraphML graph data format.
    • Standard exchange for graphs.
    • GraphML is an acronym derived from Graph Markup Language.
    • XML-based format.
    • Represents typed, attributed, directed, and undirected graphs.
    • Can also store nested graphs and hypergraphs.
    • Supports user-defined edge and vertex types.
    • Proposed by the GraphML working group in 2001.

Import & Export

  • Import["file.graphml"] imports the graphs stored in the specified file, given as a single Graph object or a list of graphs.
  • Export["file.graphml",expr] exports an adjacency matrix or edge information for one graph or for multiple graphs to the GraphML format.
  • Import["file.graphml",elem] imports the specified element from a GraphML file.
  • Import["file.graphml",{elem,suba,subb,…}] imports a subelement.
  • Import["file.graphml",{{elem1,elem2,…}}] imports multiple elements.
  • The import format can be specified with Import["file","GraphML"] or Import["file",{"GraphML",elem,…}].
  • Export["file.graphml",expr,elem] creates a GraphML file by treating expr as specifying element elem.
  • Export["file.graphml",{expr1,expr2,…},{{elem1,elem2,…}}] treats each expri as specifying the corresponding elemi.
  • Export["file.graphml",expr,opt1->val1,…] exports expr with the specified option elements taken to have the specified values.
  • Export["file.graphml",{elem1->expr1,elem2->expr2,…},"Rules"] uses rules to specify the elements to be exported.
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "AdjacencyMatrix"edge information, given as a list of matrices
    "EdgeAttributes"edge attributes, represented as a list of rules
    "EdgeLabels"list of strings representing edge labels
    "EdgeRules"connectivity data for all graphs, given as an array of rules
    "Graph"first graph stored in the file, given as a Graph object
    "Graphics"first graph stored in the file, rendered as a graph plot
    "GraphicsList"all graphs given as a list of graphics objects
    "GraphList"all graphs stored in the file, given as a list of Graph objects
    "VertexAttributes"vertex attributes, represented as a list of rules
    "VertexCount"number of vertices in each graph, given as a list of integers
    "VertexList"vertices, given as a list of strings
  • Import by default uses "Graph" for simple GraphML files and "GraphList" for multigraph GraphML files.
  • Element specifications for GraphML files containing multiple graphs:
  • "GraphNames"names of the graphs, given as a list of strings
    elem,"name"element elem for the graph specified by "name"
    elem,ndata representation element elem for the n^(th) graph in this file
    elem,{n1,n2,…}element elem for graphs n1, n2, …
    elem,Allelement elem for all graphs, given as a list

Options

  • General Import options:
  • ImageSizeAutomaticspecifies the overall size of the image to display for a graph
  • When importing from GraphML, all options supported by Graph can be given. Common settings include:
  • EdgeLabelsAutomaticlabels and label placement for edge
    EdgeWeightAutomaticweight for edge
    VertexCoordinatesAutomaticcenter coordinate for vertex
    VertexLabelsAutomaticlabels and label placement for vertex
    VertexShapeAutomaticgraphic shape for vertex
  • When importing "Graphics", all options supported by GraphPlot can be given. Common settings include:
  • DirectedEdgesAutomaticwhether to show edges as directed arrows
    EdgeLabelsAutomaticwhether to include labels given for edges
    EdgeShapeFunctionAutomaticfunction to give explicit graphics for edges
    VertexLabelsAutomaticwhether to show vertex names as labels
    VertexShapeFunctionAutomaticfunction to give explicit graphics for vertices
  • When exporting from a Graph object, Wolfram Language graph attribute values are often exported as strings using Compress.

Examples

open all close all

Basic Examples  (7)

Import a graph from a GraphML file:

Wolfram Language code: Import["ExampleData/directed.graphml"]

Export a Graph object to GraphML:

Wolfram Language code: Export[ "harary.graphml", HararyGraph[4, 8]]

Export graph data to GraphML:

Wolfram Language code: Export[ "cubical.graphml", "EdgeRules" -> GraphData["CubicalGraph", "EdgeRules"], "Rules" ]

Import a graph from the exported file:

Wolfram Language code: Import["cubical.graphml"]

Show the Import elements available in an example file:

Wolfram Language code: Import["ExampleData/attributes.graphml", "Elements"]

Import edge and vertex labels and the connectivity rules from this file:

Wolfram Language code: Import["ExampleData/attributes.graphml", {{"EdgeLabels", "VertexList", "EdgeRules"}} ]

Import as a Graph object:

Wolfram Language code: Import["ExampleData/attributes.graphml", "Graph", VertexLabels -> "Name", ImagePadding -> 10]

Import the edge attributes in an example file:

Wolfram Language code: Import["ExampleData/attributes.graphml", "EdgeAttributes"]

Scope  (1)

Import and plot a graph, displaying vertex labels:

Wolfram Language code: Import["ExampleData/simple.graphml", "Graphics", VertexLabels -> Automatic]

See Also

Import  Export  CloudExport  CloudImport

Formats: Graph6  GXL  DOT

Related Guides

    ▪
  • Importing & Exporting
  • ▪
  • Listing of All Formats
  • ▪
  • Mathematical Data
  • ▪
  • Mathematical Data Formats

History

Introduced in 2010 (8.0)

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • AI Access
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English