Search this API

y.io.graphml.output
Interface HierarchySupport

All Known Implementing Classes:
GroupingBasedHierarchySupport, HierarchyManagerBasedHierarchySupport

public interface HierarchySupport

Helper interface to determine additional data that are necessary to correctly write hierarchically (nested) graphs.

 

Method Summary
 NodeList getChildren(GraphMLWriteContext context, Node n)
          Returns the child nodes of a group/folder nodes.
 Node getNearestCommonAncestor(GraphMLWriteContext context, Node n1, Node n2)
          Returns the nearest common ancestor node of n1 and n2.
 Node getParent(GraphMLWriteContext context, Node n)
          Gets the parent node of n.
 Node getRoot(GraphMLWriteContext context)
          Gets the root node of a hierarchy.
 Node getSourceNode(GraphMLWriteContext context, Edge edge)
          Returns the source node of edge.
 Graph getSubgraph(GraphMLWriteContext context, Node n)
          Gets the subgraph object that is represented by the node n.
 EdgeList getSubgraphEdges(GraphMLWriteContext context, Graph g)
          Returns all edges that lie completely in g.
 Node getTargetNode(GraphMLWriteContext context, Edge edge)
          Returns the target node of edge.
 boolean isLeafNode(GraphMLWriteContext context, Node n)
          Returns whether n is a leaf node or a group/folder node.
 

Method Detail

isLeafNode

boolean isLeafNode(GraphMLWriteContext context,
                   Node n)
Returns whether n is a leaf node or a group/folder node.

Parameters:
context - The current write context.
n - The node to test.
Returns:
true iff n is a leaf node, false if it's a group or folder node.

getChildren

NodeList getChildren(GraphMLWriteContext context,
                     Node n)
Returns the child nodes of a group/folder nodes.

If n is not a group node, the result is undefined.

Parameters:
context - The current write context.
n - The node to query.
Returns:
The child nodes of n.

getRoot

Node getRoot(GraphMLWriteContext context)
Gets the root node of a hierarchy.

This may be null depending on the actual implementation and therefore should be used only as a handle for further queries on the hierarchy.

Parameters:
context - The current write context.
Returns:
The root node of a hierarchy.

getParent

Node getParent(GraphMLWriteContext context,
               Node n)
Gets the parent node of n.

The result is guaranteed to be either group or folder node, or the root of the hierarchy as returned by getRoot(GraphMLWriteContext)

Parameters:
context - The current write context.
n - The node to query.
Returns:
The parent node of n.

getNearestCommonAncestor

Node getNearestCommonAncestor(GraphMLWriteContext context,
                              Node n1,
                              Node n2)
Returns the nearest common ancestor node of n1 and n2.

This method always returns parent nodes of n1 and n2, even if n1 is a child of n2 or the other way round.

Parameters:
context - The current write context.
n1 - The first node.
n2 - The second node.
Returns:
The nearest common ancestor node of n1 and n2.

getSubgraphEdges

EdgeList getSubgraphEdges(GraphMLWriteContext context,
                          Graph g)
Returns all edges that lie completely in g.

Parameters:
context - The current write context.
g - The graph object to query.
Returns:
All edges that lie completely in g.

getSubgraph

Graph getSubgraph(GraphMLWriteContext context,
                  Node n)
Gets the subgraph object that is represented by the node n.

This instance is only meaningful for containment queries like Graph.contains(y.base.Node) and should not be used by code outside the core writing process.

Parameters:
context - The current write context.
n - The node to query.
Returns:
The subgraph object that is represented by the node n.

getSourceNode

Node getSourceNode(GraphMLWriteContext context,
                   Edge edge)
Returns the source node of edge.

In case of folder nodes, this is the real source node.

Parameters:
context - The current write context.
edge - The edge to test.
Returns:
The source node of edge.

getTargetNode

Node getTargetNode(GraphMLWriteContext context,
                   Edge edge)
Returns the target node of edge.

In case of folder nodes, this is the real target node.

Parameters:
context - The current write context.
edge - The edge to test.
Returns:
The target node of edge.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.