The GraphML format is a standard format that describes graphs in a simplified way. It is an XML based format based on predefined tags like <node&rt; and <edge&rt; tags
(see GraphML primer). All GraphML specifications are handled except hyper edges. This includes:
nodes and edges standard declaration;
optimized parsing of GraphML attributes;
attributes parsing on nodes and edges and extracting concrete data objects (standard and non standard attributes);
nested graphs and grouping functionalities;
ports and links anchoring.
In order to let Visualizer distinguish XML input from GraphML input, the GraphML xml must contain the surrounding <graphml> .... </graphml> tag.
Other additional useful GraphML parsing and display functionalities have been added:
parsing custom attributes on edges and nodes (e.g <node id="1" name="myName" custom="true">);
extracting disconnected sets from the parsed GML;
indicating hierarchies (via Expand/Collapse buttons and Coloring sequences);
performing layout on subGraphs;
assigning IDs to each element data according to the id attribute of each GraphML element.
Note: In the following paragraphs we will be using the following integration snippet. The dataProvider value refers to the used data source in each part.
Beyond using standard GraphML (GraphML declarations and attributes), Visualizer is able to parse GraphML items in other non standard ways
(declaring attributes and their values directly in the node or edge). It is also capable of extracting disconnected graphs, determining
their topology (hierarchical or cyclic) and enabling extra features according to the GraphML data.
After parsing, each visual element in the Visualizer will have as data value an object whose properties are the
declared attributes in the data it represents. These attributes are supposed to be Strings (data type recognition is not performed).
In the following snippet we describe a basic GraphML dataProvider and the generated graph. Notice how Visualizer (and Diagrammer)
interpret the data (non standard attributes) and how topological structure is depicted (enabling coloring and expand/collapse feature
on the hierarchical part of the data).
recognition of non standard attributes (non declared attributes);
visual element data generation;
supporting simplified groups detection: To declare groups, there is no need to surround a group content with graph tag.
A group can be declared as a GraphML node where its XML children are the contained nodes. The following GraphML declarations are equivalent.
GraphML supports declaring the locations on each node where links are connected.
These locations are names ports for nodes and anchors for links and the visualizer supports GraphML ports and anchors.
Each declared anchor is registered in the anchors property (a Descriptor containing
anchoring description) in each visual node (ISprite instance) that specifies its anchoring. Each visual link (ILink instance) will
get its sourceAnchorIndex and targetAnchorIndex properties updated
with the right value (index in the source or target node anchors).
In the following snippet we describe a basic GraphML dataProvider where several anchors are defined.
Notice how Visualizer (and Diagrammer) anchors are taken into account in layout and in displacing nodes.