nz.ac.waikato.jdsl.graph.api
Interface ModifiableGraph

All Superinterfaces:
Container, InspectableContainer, InspectableGraph, InspectablePositionalContainer, PositionalContainer
All Known Subinterfaces:
Graph
All Known Implementing Classes:
IncidenceListGraph

public interface ModifiableGraph
extends InspectableGraph, PositionalContainer

An interface describing the modifier methods of a combinatorial graph that can safely be inherited by more restricted graphs.

Version:
JDSL 2.1.1
Author:
Luca Vismara (lv)
See Also:
InspectableGraph

Method Summary
 void makeUndirected(Edge e)
          Makes a directed edge undirected.
 void reverseDirection(Edge e)
          Reverse the direction of an edge.
 void setDirectionFrom(Edge e, Vertex v)
          Sets the direction of an edge away from a vertex.
 void setDirectionTo(Edge e, Vertex v)
          Sets the direction of an edge towards a vertex.
 Vertex splitEdge(Edge e, java.lang.Object vertElement)
          Splits an existing edge by inserting a new vertex and two new edges, and removing the old edge.
 Edge unsplitEdge(Vertex v, java.lang.Object edgeElement)
          Transforms edge-vertex-edge into a single edge.
 
Methods inherited from interface nz.ac.waikato.jdsl.graph.api.InspectableGraph
aCommonVertex, aConnectingEdge, adjacentVertices, adjacentVertices, anEdge, anIncidentEdge, anIncidentEdge, areAdjacent, areAdjacent, areIncident, aVertex, connectingEdges, degree, degree, destination, directedEdges, edges, endVertices, incidentEdges, incidentEdges, isDirected, numEdges, numVertices, opposite, origin, undirectedEdges, vertices
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.PositionalContainer
swapElements
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.InspectablePositionalContainer
positions
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.Container
newContainer, replaceElement
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.InspectableContainer
contains, elements, isEmpty, size
 

Method Detail

splitEdge

Vertex splitEdge(Edge e,
                 java.lang.Object vertElement)
                 throws InvalidAccessorException
Splits an existing edge by inserting a new vertex and two new edges, and removing the old edge. If the edge is directed, the two new edges maintain the direction. The old edge is removed; its element() can still be retrieved. The new edges store null elements, and the new vertex stores the specified element.

Parameters:
e - the edge to be split
vertElement - the object to be stored in v
Returns:
the new vertex w; to get the new edges, use method incidentEdges(w)
Throws:
InvalidAccessorException - if the edge does not belong to this graph

unsplitEdge

Edge unsplitEdge(Vertex v,
                 java.lang.Object edgeElement)
                 throws InvalidAccessorException,
                        InvalidVertexException
Transforms edge-vertex-edge into a single edge. The vertex must be of degree 2. The edges and the vertex are removed (their element()s can still be retrieved), and a new edge is inserted in their place. The new edge stores the specified element.

If the two incident edges of v are consistently directed, the new edge is directed in that direction. If they are both undirected, the new edge is undirected. Any other combination of directions also results in an undirected edge.

Parameters:
v - the vertex to be removed
edgeElement - the element to be stored in the new edge
Returns:
the new edge
Throws:
InvalidVertexException - If the vertex is not of degree 2 or is of degree 2 but the "two" edges are a single self-loop
InvalidAccessorException - if the vertex does not belong to this graph

setDirectionFrom

void setDirectionFrom(Edge e,
                      Vertex v)
                      throws InvalidAccessorException,
                             InvalidVertexException
Sets the direction of an edge away from a vertex. Makes an undirected edge directed.

Parameters:
e - an edge
v - an endvertex of e
Throws:
InvalidVertexException - if v is not an endvertex of e but both v and e belong to this graph
InvalidAccessorException - if either e or v does not belong to this graph

setDirectionTo

void setDirectionTo(Edge e,
                    Vertex v)
                    throws InvalidAccessorException,
                           InvalidVertexException
Sets the direction of an edge towards a vertex. Makes an undirected edge directed.

Parameters:
e - an edge
v - an endvertex of e
Throws:
InvalidVertexException - if v is not an endvertex of e
InvalidAccessorException - if either e or v does not belong to this graph

makeUndirected

void makeUndirected(Edge e)
                    throws InvalidAccessorException
Makes a directed edge undirected. Does nothing if the edge is undirected.

Parameters:
e - an edge
Throws:
InvalidAccessorException - if the edge does not belong to this graph

reverseDirection

void reverseDirection(Edge e)
                      throws InvalidEdgeException,
                             InvalidAccessorException
Reverse the direction of an edge.

Parameters:
e - an edge
Throws:
InvalidEdgeException - If the edge is undirected
InvalidAccessorException - if the edge does not belong to this graph


Copyright © 2009 ModelJUnit Project. All Rights Reserved.