yFiles Tutorial I/O Demos

The following demos show how to use, customize, and extend the graph input and output facilities provided by yFiles.

Class Description
demo.io.SimpleGMLDemo Shows how to read in a graph specified in GML file format.
demo.io.CustomGMLDemo Demonstrates how to write encoders and parsers for a customized GML graph format. It is shown how to associate arbitrary attributes with nodes dynamically, encode them in GML and parse them back in. Additionally, the use of customized PopupModes and OptionHandlers is demonstrated briefly.
Note that this demo makes use of the following classes: demo.io.CustomGMLFactory, demo.io.CustomNodeObjectEncoder, and demo.io.CustomNodeParser.
demo.io.GraphFormatConverterThis class implements a command line driven graph format converter. Possible input formats are GML or YGF. Output formats are GML, YGF, GIF, and JPG. Additionally, it is possible to write to the formats PDF, EMF, SWF, EPS, GraphML, ZIPGraphML, SVG, and SVGZ and to read from the formats GraphML and ZIPGraphML in case the corresponding yFiles extension packages ySVG, yExport and GraphML are installed. The size of some output formats can be specified.
demo.io.ImageMapDemoThis class shows how to generate an image and a hyperlinked HTML image map of a graph.
demo.io.TiledImageDemo This class shows how to export a diagram to multiple image tiles. Also, this demo shows how to add a title to the exported diagram.

Running the Demos

From Within an IDE

Set <yFilesDir>/src as your source directory. Then add <yFilesDir>/lib/y.jar and the source folder <yFilesDir>/src to your classpath. Now you should be ready to compile and run all executable demo classes.

With Ant

First make sure you have the build tool Ant installed on your system. Now you can use the demo build script build.xml located in <yFilesDir>/src/demo to launch each demo by specifying its simple class name as a target. Alternatively, launch the interactive demo driver by specifying run as target to conveniently access all demos.