public interface NodeAdapter
This adapter interface assumes certain things about the graph data structure. We have tried to make these assumptions such that it will not be too hard to write adapters for almost all types of graph Each node is connected to a single node at its head and tail (except for hyper-edges, see below). Nodes and edges are contained in a parent object, which can be the root graph, a composite node, or a hyper-edge. The adapter interfaces do not assume anything about whether edges can connect to objects outside of their parent object.
Sometimes, it will be possible to use the adapter to construct a graph that does not make sense for the native data structure. Implementations of the adapter can thrown an exception of this happens. However, there is no need to be regimental about it: the application is also responsible for constructing the interaction that takes place on the graph, and as long as that is built correctly then invalid graph structures should not occur.
Nodes can be composite, in which case they can contain nodes and edges themselves. Whether or not edges that connect to sub-nodes of the composite are parented by the composite, or by the root graph, is something that the adapter interfaces (and GraphModel) are indifferent to.
Modifier and Type | Method and Description |
---|---|
int |
getNodeCount(Object composite)
Return a count of the nodes this graph contains.
|
Object |
getParent(Object node)
Return the parent of the given node.
|
Iterator |
inEdges(Object node)
Return an iterator over the edges coming into the given node.
|
boolean |
isComposite(Object node)
Return true if the given node is a composite, that is, it
contains other nodes.
|
Iterator |
nodes(Object composite)
Return an iterator over the nodes that this graph contains.
|
Iterator |
outEdges(Object node)
Return an iterator over the edges coming out of the given node.
|
void |
setParent(Object node,
Object parent)
Set the graph parent of the given node.
|
boolean isComposite(Object node)
int getNodeCount(Object composite)
Iterator outEdges(Object node)
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.