Chapter 4. Input and Output

Table of Contents

Graph Exchange and Graph Export Formats
Reading and Writing Graph Structure Data Using GraphML
What GraphML Looks Like
Working with the GraphML File Format
GraphML Attributes
Reading and Writing Additional Data
Simple vs. Structured Type Support
Reading and Writing Data Using IMappers as Data Holders
General (De)Serialization Support
Custom Serialization and Deserialization
Tutorial Demo Code
Exporting the Canvas's Content
Image Export Infrastructure
Bitmap-based Image File Formats
EMF

This chapter presents various file formats that are supported with yFiles.NET as graph exchange and graph export formats, respectively. It also explains which classes to use for reading and writing graph structure data and how to prepare a graph for image export.

Graph Exchange and Graph Export Formats

The GraphML file format presents the native graph exchange format supported by yFiles.NET. Classes from the yWorks.Canvas.IO namespace provide the functionality for exporting the contents of a GraphControl to a variety of image file formats, both vector graphics or bitmap-based.

Table 4.1, “Graph exchange and export file formats” lists the features of all yFiles.NET graph exchange and export file formats.

Table 4.1. Graph exchange and export file formats

Format Name (Abbreviation) Human Readable Type Note
GraphML Yes Exchange XML-based
EMF No Export (Vector Graphics)  
BMP, GIF, JPG, PNG, TIFF No Export (Bitmap) Provided by class PixelImageExporter.

Beyond the graph structure, graph exchange format GraphML also supports all visual attributes directly related to the representation of graph elements. In particular, this includes the styles for nodes, edges, ports, etc. which are defined by interfaces INodeStyle, IEdgeStyle, IPortStyle, etc. However, GraphML provides no direct support for further visual aspects like, e.g., zoom level, selection state, or a background image. In contrast, the graph export formats fully support these visual aspects.