Graph Structure Memory Requirements
Applies to: yFiles 2.6, yFiles WPF 1.0, yFiles.NET 3.1 print article email article

Type: Questions & Answers

Memory requirements for the yFiles graph structure types.

The tables below give an overview of the approximate memory consumption for nodes and edges.
Note
Keep in mind that memory consumption for any Java type ultimately depends on the Java Virtual Machine that instantiates the type.

Graph: Basic Graph Structure

In a Graph only the basic graph structure is stored, i.e., only structural information. Essentially, this means information like "node A is connected to node B" (by an edge).

The following table shows the approximate memory consumption when creating graph elements.

Node Edge Notes
bytes (approx.)
80 80 Structural information only.

For more information concerning the basic graph structure types, please see the corresponding section in the yFiles Developer's Guide.

DefaultLayoutGraph: Additional Layout Information

In a DefaultLayoutGraph, nodes and edges additionally hold layout information. This includes position and dimensions for nodes and positions of control points for edges (more precisely their edge paths). Control point, or simply point, subsumes both bends and ports of an edge path.
DefaultLayoutGraph inherits from class y.base.Graph.

The following table shows the approximate memory consumption when creating graph elements.

Node Edge Notes
bytes (approx.)
120 160 Includes layout information.

When adding a point (bend) to an edge using method EdgeLayout.addPoint(double, double), memory consumption increases by 24 bytes (approx.). The same holds true for setting either source point (port) or target point (port).

For more information concerning the layout graph structure types, please see the corresponding section in the yFiles Developer's Guide.

Graph2D: Additional Information for Visual Representation

In a Graph2D, nodes and edges are additionally associated so-called realizers that are responsible for the visual representation of the graph element.
Graph2D inherits from class y.layout.LayoutGraph (which itself inherits from y.base.Graph).

The following table shows the approximate memory consumption when creating graph elements.

Node Edge Notes
bytes (approx.)
440 328 Default realizers are used for the visual representation, i.e., ShapeNodeRealizer and PolyLineEdgeRealizer.

When adding a Bend object to an edge realizer using method appendBend, memory consumption increases by 56 bytes (approx.). Additional NodeLabel and EdgeLabel objects (empty, i.e., without text) add 168 bytes (approx.) and 264 bytes (approx.) to the memory footprint of a graph. Note that node realizers already hold one empty NodeLabel when created.

// 'g' is of type y.view.Graph2D.
// 'n' is of type y.base.Node, 'e' is of type y.base.Edge.

// Adding a NodeLabel to a node.
g.getRealizer(n).addLabel(g.getRealizer(n).createNodeLabel());
// Adding an EdgeLabel to an edge.
g.getRealizer(e).addLabel(g.getRealizer(e).createEdgeLabel());

Using ImageNodeRealizer instead of ShapeNodeRealizer for the visual representation of nodes needs 400 bytes (approx.) per node. An additional 50KB (approx.) is allocated statically with class ImageNodeRealizer for managing the static image cache.
Images that are added to the image cache can be shared among ImageNodeRealizer instances, i.e., if multiple nodes use the same image, it is only needed once in the cache.

Note
When adding images to the cache (especially JPG images), keep in mind that the internal representation of the image in general needs more memory than the file itself in the file system.

For more information concerning the visual graph structure types, please see the corresponding section in the yFiles Developer's Guide.

Hierarchically Organized Graph2D

Group nodes and folder nodes in hierarchically organized graphs that are created using HierarchyManager's createGroupNode(Graph)/ createFolderNode(Graph) methods, consume 944 bytes (approx.) and 2088 bytes (approx.), respectively.
By default, for the visual representation of both group nodes and folder nodes GroupNodeRealizer is used.

If DefaultHierarchyGraphFactory's setProxyNodeRealizerEnabled is set to true, however, ProxyAutoBoundsRealizers with two delegate GroupNodeRealizers are used instead. Upon creation of a group node or folder node, then 2016 bytes (approx.) or 3160 bytes (approx.), respectively add to the memory footprint of a graph.

The difference in size between group node and folder node stems from the fact that when a folder node is created, an additional Graph2D is created to hold the inner graph of the folder.

For more information concerning realizers in hierarchically organized graphs, please see the corresponding section in the yFiles Developer's Guide.


Keywords: memory - node - edge - realizer - label - layout - Graph2D - DefaultLayoutGraph - LayoutGraph - graph - structure - Graph - NodeRealizer - EdgeRealizer - group node - GroupNodeRealizer - ProxyAutoBoundsNodeRealizer - ImageNodeRealizer - ShapeNodeRealizer - PolyLineEdgeRealizer - NodeLabel - EdgeLabel - delegate

Provide feedback:
How useful was this article?    less 1 2 3 4 5 more
Email address (optional):
COPYRIGHT © 2008 yWorks · ALL RIGHTS RESERVED imprint | top | home