|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jdsl.core.ref.AbstractPositionalContainer | +--jdsl.graph.ref.AbstractGraph
An implementation of many of the methods of InspectableGraph in terms of a few primitives. Note that that says "InspectableGraph," not "Graph," but that this class extends AbstractPositionalContainer, which implements replaceElements(.). All the methods implemented here belong to InspectableGraph.
The implementor must define the primitives called by the
functions here. In addition, the implementor must define any
primitives needed for AbstractPositionalContainer
not defined here.
In several places when the AbstractGraph calls a method that the implementer must define, the AbstractGraph is relying on the implementer also checking the input vertex or edge for validity.
The complexities of the methods implemented here depend on the complexities of the underlying methods. Therefore, the complexity documented for each method below is based on suppositions about the underlying implementation.
Inner Class Summary | |
protected static class |
AbstractGraph.OO_to_O_MergerIterator
|
Constructor Summary | |
protected |
AbstractGraph()
|
Method Summary | |
Vertex |
aCommonVertex(Edge e1,
Edge e2)
Built on endVertices(.) |
Edge |
aConnectingEdge(Vertex v1,
Vertex v2)
Built on incidentEdges(.) |
VertexIterator |
adjacentVertices(Vertex v)
Built on incidentEdges(.) |
VertexIterator |
adjacentVertices(Vertex v,
int edgetype)
Built on incidentEdges(.) |
boolean |
areAdjacent(Edge e1,
Edge e2)
Built on endVertices(.) |
boolean |
areAdjacent(Vertex v1,
Vertex v2)
Built on incidentEdges(.) |
EdgeIterator |
connectingEdges(Vertex v1,
Vertex v2)
Built on incidentEdges(.) |
EdgeIterator |
directedEdges()
Built on edges() and isDirected(.) |
PositionIterator |
positions()
Built on vertices() and edges(). |
int |
size()
Built on numVertices() and numEdges(). |
EdgeIterator |
undirectedEdges()
Built on edges() and isDirected(.) |
Methods inherited from class jdsl.core.ref.AbstractPositionalContainer |
isEmpty, swapElements |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jdsl.graph.api.InspectableGraph |
anEdge, anIncidentEdge, anIncidentEdge, areIncident, aVertex, degree, degree, destination, edges, endVertices, incidentEdges, incidentEdges, isDirected, numEdges, numVertices, opposite, origin, vertices |
Methods inherited from interface jdsl.core.api.InspectableContainer |
contains, elements, isEmpty |
Methods inherited from interface jdsl.core.api.Container |
newContainer, replaceElement |
Constructor Detail |
protected AbstractGraph()
Method Detail |
public int size()
O(1)
size
in interface InspectableContainer
InspectableGraph.numVertices()
,
InspectableGraph.numEdges()
public PositionIterator positions()
O(V+E)
positions
in interface InspectablePositionalContainer
InspectableGraph.vertices()
,
InspectableGraph.edges()
public EdgeIterator directedEdges()
O(E)
directedEdges
in interface InspectableGraph
InspectableGraph.edges()
,
InspectableGraph.isDirected(Edge)
public EdgeIterator undirectedEdges()
O(E)
undirectedEdges
in interface InspectableGraph
InspectableGraph.edges()
,
InspectableGraph.isDirected(Edge)
public VertexIterator adjacentVertices(Vertex v)
O(deg[v])
adjacentVertices
in interface InspectableGraph
InspectableGraph.incidentEdges(Vertex)
public VertexIterator adjacentVertices(Vertex v, int edgetype)
O(deg[v])
adjacentVertices
in interface InspectableGraph
InspectableGraph.incidentEdges(Vertex)
public boolean areAdjacent(Vertex v1, Vertex v2)
O( min(v1.degree,v2.degree) )
areAdjacent
in interface InspectableGraph
InspectableGraph.areAdjacent(Vertex,Vertex)
public boolean areAdjacent(Edge e1, Edge e2)
O(1)
areAdjacent
in interface InspectableGraph
InspectableGraph.endVertices(Edge)
public EdgeIterator connectingEdges(Vertex v1, Vertex v2)
O( min(v1.degree,v2.degree) )
connectingEdges
in interface InspectableGraph
InspectableGraph.incidentEdges(Vertex)
public Edge aConnectingEdge(Vertex v1, Vertex v2)
O( min(v1.degree,v2.degree) )
aConnectingEdge
in interface InspectableGraph
InspectableGraph.incidentEdges(Vertex)
public Vertex aCommonVertex(Edge e1, Edge e2)
O(1)
aCommonVertex
in interface InspectableGraph
InspectableGraph.endVertices(Edge)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |