diva.graphx
Interface EdgeAdapter

All Known Implementing Classes:
BasicEdgeAdapter

public interface EdgeAdapter

An edge adapter is used by GraphModel to manipulate edge objects in the application's graph data structure. Since GraphModel doesn't know what this data structure is, adapter objects are used to allow it to manipulate this data structure. Typically, an application will implement EdgeAdapter once for each distinct type of edge in the graph.

Edges can be hyperedges. In this case, the methods that get a head or tail node may return an unpredictable result. Methods that set a head or tail node should do nothing. The method getHyperContents() will return a node adapter, which can be used to get nodes of the hyperedge; edges in the hyperedge should then be connected to these sub-nodes.

One aspect of the edge adapter that may cause some confusion is the fact that edges must be added to and removed from their parent. Although some graph data structure do not have an explicit notion of edge parents, some do. We decided that explicitly including these methods in the interface provided the most generic support mechanism. Applications in which edges do not have a notion of parent should simply implement setParent() as a null method, and implement getParent() to always return the root graph.

See also the documentation for the NodeAdapter interface for additional notes about node and edge adapters.

Version:
$Revision: 1.2 $
Author:
Michael Shilman, John Reekie
See Also:
NodeAdapter

Method Summary
 boolean acceptHead(Object edge, Object head)
          Return whether or not the given node is a valid head of this edge.
 boolean acceptTail(Object edge, Object tail)
          Return whether or not the given node is a valid tail of this edge.
 Object getHead(Object edge)
          Return the node at the head of this edge.
 NodeAdapter getHyperContent(Object edge)
          Get the node adapter for the content of a hyper-edge.
 Object getParent(Object edge)
          Return the parent of the given edge.
 Object getTail(Object edge)
          Return the node at the tail of this edge.
 boolean isDirected(Object edge)
          Return whether or not this edge is directed.
 boolean isHyper(Object edge)
          Return whether or not this edge is a hyperedge.
 void setHead(Object edge, Object head)
          Set the node that this edge points to.
 void setParent(Object edge, Object parent)
          Set the graph parent of the given edge.
 void setTail(Object edge, Object tail)
          Set the node that this edge stems from.
 

Method Detail

acceptHead

boolean acceptHead(Object edge,
                   Object head)
Return whether or not the given node is a valid head of this edge.


acceptTail

boolean acceptTail(Object edge,
                   Object tail)
Return whether or not the given node is a valid tail of this edge.


getHead

Object getHead(Object edge)
Return the node at the head of this edge. The meaning of this method is undefined if this edge is a hyperedge.


getHyperContent

NodeAdapter getHyperContent(Object edge)
Get the node adapter for the content of a hyper-edge. This method should return null is isHyper() is false. The returned node adapter provides access to the internal nodes of the hyper-edge.


getParent

Object getParent(Object edge)
Return the parent of the given edge.


getTail

Object getTail(Object edge)
Return the node at the tail of this edge. The meaning of this method is undefined if this edge is a hyperedge.


isDirected

boolean isDirected(Object edge)
Return whether or not this edge is directed.


isHyper

boolean isHyper(Object edge)
Return whether or not this edge is a hyperedge. A hyperedge itself contains nodes, which can be accessed using the getHyperContent() method.


setHead

void setHead(Object edge,
             Object head)
Set the node that this edge points to. Implementors of this method are also responsible for insuring that it is set properly as an "incoming" edge of the node, and that it is removed as an incoming edge from its previous head node. The meaning of this method is undefined if this edge is a hyperedge.


setParent

void setParent(Object edge,
               Object parent)
Set the graph parent of the given edge. Implementors of this method are also responsible for insuring that it is set properly as the child of the parent.


setTail

void setTail(Object edge,
             Object tail)
Set the node that this edge stems from. Implementors of this method are also responsible for insuring that it is set properly as an "outgoing" edge of the node, and that it is removed as an outgoing edge from its previous tail node. The meaning of this method is undefined if this edge is a hyperedge.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.