|
|||||||||
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 | +--jdsl.graph.ref.InspectableSubgraph
This class represents a subgraph of an InspectableGraph
. It
can be constructed from a set of vertices or edges
Note that Positions
returned by the
subgraph will be the same as the positions returned in the original graph.
Even though this is an AbstractGraph
, you may not modify this
graph. All attempts to do so will fail.
This graph maintains a reference to the graph upon which this subgraph is
induced. If that graph changes, then the inspectable graph will change.
Inner classes inherited from class jdsl.graph.ref.AbstractGraph |
AbstractGraph.OO_to_O_MergerIterator |
Constructor Summary | |
InspectableSubgraph(InspectableGraph graph,
EdgeIterator edges)
Constructs the subgraph induced by the given edges. |
|
InspectableSubgraph(InspectableGraph graph,
VertexIterator vertices)
Constructs the subgraph induced by the given vertices. |
Method Summary | |
Edge |
anEdge()
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
Edge |
anIncidentEdge(Vertex v)
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
Edge |
anIncidentEdge(Vertex v,
int edgeType)
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
boolean |
areIncident(Vertex v,
Edge e)
O(1) |
Vertex |
aVertex()
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
boolean |
contains(Accessor a)
O(1) |
int |
degree(Vertex v)
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
int |
degree(Vertex v,
int edgeType)
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
Vertex |
destination(Edge e)
O(1) |
EdgeIterator |
edges()
O(E in subgraph ) |
ObjectIterator |
elements()
Runs in time proportional to vertices() +
elements() in the subgraph. |
Vertex[] |
endVertices(Edge e)
|
EdgeIterator |
incidentEdges(Vertex v)
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
EdgeIterator |
incidentEdges(Vertex v,
int edgeType)
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
boolean |
isDirected(Edge e)
This runs in time proportional to the running time of the corresponding method in the graph around which this subgraph wraps. |
Container |
newContainer()
This method is unsupported. |
int |
numEdges()
O(1) |
int |
numVertices()
O(1) |
Vertex |
opposite(Vertex v,
Edge e)
O(1) |
Vertex |
origin(Edge e)
O(1) |
java.lang.Object |
replaceElement(Accessor a,
java.lang.Object obj)
This method is unsupported. |
VertexIterator |
vertices()
O( V in subgraph ) |
Methods inherited from class jdsl.graph.ref.AbstractGraph |
aCommonVertex, aConnectingEdge, adjacentVertices, adjacentVertices, areAdjacent, areAdjacent, connectingEdges, directedEdges, positions, size, undirectedEdges |
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.core.api.InspectableContainer |
isEmpty |
Constructor Detail |
public InspectableSubgraph(InspectableGraph graph, VertexIterator vertices)
public InspectableSubgraph(InspectableGraph graph, EdgeIterator edges)
Method Detail |
public java.lang.Object replaceElement(Accessor a, java.lang.Object obj) throws InvalidAccessorException
jdsl.core.api.Container
a
- Accessor in this containernewElement
- to be stored at aInvalidAccessorException
- if a is null or does not
belong to this containerpublic int numVertices()
jdsl.graph.api.InspectableGraph
public VertexIterator vertices()
jdsl.graph.api.InspectableGraph
public int numEdges()
jdsl.graph.api.InspectableGraph
public EdgeIterator edges()
jdsl.graph.api.InspectableGraph
public EdgeIterator incidentEdges(Vertex v)
jdsl.graph.api.InspectableGraph
v
- a vertexv
InvalidAccessorException
- if v
is not
contained in this graphpublic EdgeIterator incidentEdges(Vertex v, int edgeType)
jdsl.graph.api.InspectableGraph
v
- a vertexedgetype
- A constant from the EdgeDirection
interfacev
InvalidAccessorException
- if v
is not
contained in this graphEdgeDirection
public boolean isDirected(Edge e)
jdsl.graph.api.InspectableGraph
e
- an edgetrue
if e
is directed,
false
otherwiseInvalidAccessorException
- if e
is not
contained in this graphpublic Vertex[] endVertices(Edge e) throws InvalidAccessorException
jdsl.graph.api.InspectableGraph
e
- an edgee
;
if e
is directed, the first element of the array is the origin of e
and the second element is the destination of e
InvalidAccessorException
- if e
is not
contained in this graphpublic Vertex aVertex()
jdsl.graph.api.InspectableGraph
public Edge anEdge()
jdsl.graph.api.InspectableGraph
public Vertex opposite(Vertex v, Edge e)
jdsl.graph.api.InspectableGraph
v
- one endvertex of e
e
- an edgee
different from v
InvalidVertexException
- if v
is not an
endvertex of e
InvalidAccessorException
- if v
or e
is not contained in this graphpublic Vertex origin(Edge e)
jdsl.graph.api.InspectableGraph
e
- an edgee
, if e
is directedInvalidEdgeException
- if e
is undirectedInvalidAccessorException
- if e
is not
contained in this graphpublic Vertex destination(Edge e)
jdsl.graph.api.InspectableGraph
e
- an edgee
, if
e
is directedInvalidEdgeException
- if e
is undirectedInvalidAccessorException
- if e
is not
contained in this graphpublic boolean areIncident(Vertex v, Edge e)
jdsl.graph.api.InspectableGraph
v
- a vertexe
- an edgev
and e
are incident,
i.e., whether v
is an endvertex of e
InvalidAccessorException
- if either v
or
e
is not contained in this graphpublic Container newContainer()
jdsl.core.api.Container
public boolean contains(Accessor a)
jdsl.core.api.InspectableContainer
InvalidAccessorException
- if a is nullpublic Edge anIncidentEdge(Vertex v) throws NoSuchEdgeException, InvalidAccessorException
jdsl.graph.api.InspectableGraph
v
- a vertexv
, or Edge.NONE if
there is no edge incident on v
InvalidAccessorException
- if v
is not
contained in this graphpublic Edge anIncidentEdge(Vertex v, int edgeType)
jdsl.graph.api.InspectableGraph
v
- a vertexedgetype
- A constant from the EdgeDirection
interfacev
,
or Edge.NONE if there is no such edge incident on v
InvalidAccessorException
- if v
is not
contained in this graphEdgeDirection
public int degree(Vertex v)
jdsl.graph.api.InspectableGraph
v
- a vertexv
InvalidAccessorException
- if v
is
not contained in this graphpublic int degree(Vertex v, int edgeType)
jdsl.graph.api.InspectableGraph
v
- a vertexedgetype
- A constant from the EdgeDirection
interfacev
InvalidAccessorException
- if v
is
not contained in this graphEdgeDirection
public ObjectIterator elements()
vertices()
+
elements()
in the subgraph.jdsl.core.api.InspectableContainer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |