The GraphMLIOHandler
The central class for reading and writing GraphML is the GraphMLIOHandler. Besides its methods for reading and writing graphs, it offers several customization hooks.
- readFromDocument(graph: IGraph, document: Document): Promise<IGraph>
- readFromGraphMLText(graph: IGraph, data: string): Promise<IGraph>
- readFromURL(graph: IGraph, url: string): Promise<IGraph>
- Parses GraphML from different sources and populates the given graph.
- write(graph: IGraph): Promise<string>
- Returns a promise with the given graph as GraphML string.
By default, the GraphMLIOHandler reads and writes GraphML, which encodes all structural, visual, and geometric information of a graph. You can easily configure the GraphMLIOHandler to write additional business data that is associated with graph elements or the graph itself. This data can be of a simple type like string, for example, encoding a tooltip or a link. It is also possible, though, to encode complex data like objects that model the entire business data behind a graph item.
Events for Reading and Writing
GraphMLIOHandler provides events that are fired at different stages of reading or writing a graph. The most common use case is to perform an action after a graph is loaded. For example, you might want to apply a layout algorithm to the loaded graph.