jdsl.graph.api
Interface ModifiableGraph
- All Superinterfaces:
- Container, InspectableContainer, InspectableGraph, InspectablePositionalContainer, PositionalContainer
- All Known Subinterfaces:
- Graph
- 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.0.6
- Author:
- Luca Vismara (lv)
- See Also:
InspectableGraph
Methods inherited from interface 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 |
splitEdge
public 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 splitvertElement
- 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
public 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 removededgeElement
- 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-loopInvalidAccessorException
- if the vertex does not
belong to this graph
setDirectionFrom
public 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 edgev
- an endvertex of e
- Throws:
InvalidVertexException
- if v
is not an
endvertex of e
but both v
and
e
belong to this graphInvalidAccessorException
- if either e
or
v
does not belong to this graph
setDirectionTo
public 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 edgev
- 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
public 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
public void reverseDirection(Edge e)
throws InvalidEdgeException,
InvalidAccessorException
- Reverse the direction of an edge.
- Parameters:
e
- an edge- Throws:
InvalidEdgeException
- If the edge is undirectedInvalidAccessorException
- if the edge does not belong
to this graph