de.grogra.graph
public interface Path
Path consists of an alternating sequence of nodes and edges
(starting with a node) of a graph. An edge of a graph is incident with
its neighbouring nodes in the path.
The nodes and edges of this path are accessed using their index. Because
a path starts with a node, nodes have even indices, while edges haves odd
indices. If the index parameter to one of the methods of
Path is negative, it is interpreted as an index relative
to the end of the path, i.e., the actual index is
path.getNodeAndEdgeCount () + index.
| Modifier and Type | Field and Description |
|---|---|
static Path[] |
PATH_0
A constant array of length 0.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getEdgeBits(int index)
Returns the edge bits (see
Graph.getEdgeBits(Object))
of the edge at index. |
Graph |
getGraph()
Returns the graph which contains this path.
|
int |
getNodeAndEdgeCount()
Returns the number of nodes and edges of this path.
|
java.lang.Object |
getObject(int index)
Returns the node or edge at
index. |
long |
getObjectId(int index) |
boolean |
isInEdgeDirection(int index)
Checks whether the path traverses the edge at
index
in edge direction or in reverse edge direction. |
boolean |
isInstancingEdge(int index) |
static final Path[] PATH_0
int getEdgeBits(int index)
Graph.getEdgeBits(Object))
of the edge at index.
If index is negative, it is relative to the end
of the list, i.e., it is incremented by getNodeAndEdgeCount().
The actual index has to be odd because edges have odd indices.index - edge indexGraph getGraph()
int getNodeAndEdgeCount()
java.lang.Object getObject(int index)
index. Because a path
always starts with a node, even values of index address
nodes, while odd values address edges. Edges may be returned
as null, in this case only the information provided
by getEdgeBits(int) and isInEdgeDirection(int)
is available for the edge.
If index is negative, it is relative to the end
of the list, i.e., it is incremented by getNodeAndEdgeCount().index - node or edge indexindexlong getObjectId(int index)
boolean isInEdgeDirection(int index)
index
in edge direction or in reverse edge direction.
If index is negative, it is relative to the end
of the list, i.e., it is incremented by getNodeAndEdgeCount().
The actual index has to be odd because edges have odd indices.index - edge indextrue iff path traverses edge in its directionboolean isInstancingEdge(int index)