|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Path
Class representing a path in a Graph as a sequence of connected nodes.
NodeIterator
Constructor Summary | |
|
Path()
Creates a new empty Path. |
protected |
Path(java.util.ArrayList nodes)
Wraps a new Path object around this vector. |
|
Path(int[] apath)
Creates a new Path representing apath[0]->..->apath[apath.length-1] . |
|
Path(int i,
int j)
Creates a new path being the edge ( i ,j ). |
Method Summary | |
void |
addBack(int node)
Adds node node to the end of this Path. |
void |
addFront(int node)
Adds node node to the end of this Path (O(length)). |
void |
append(Path p)
Appends p to this path where appropriate. |
java.lang.Object |
clone()
Implementation of the Cloneable interface. |
Path |
concat(Path p)
Returns the concatenation of this path with the path p
as a new Path object. |
NodeIterator |
first()
Returns an NodeIterator over the nodes of this Path following the edges of this Path starting at the first node (by a call to the next() method). |
int[] |
intersection(Path p)
Returns the nodes common in both paths. |
boolean |
isCanonical()
True if this path is cylic canonical. |
NodeIterator |
last()
Returns an NodeIterator over the nodes of this Path following the edges of this Path starting at the last node (by a call to the previous() method) |
int |
length()
Returns the length of this Path (nr of edges). |
int |
nodeAt(int d)
Returns the node at distance d from the startnode
of this Path. |
NodeIterator |
nodeIterator(int node)
Returns an NodeIterator over the nodes of this Path following the edges of this path starting at the specified node (by a call to the next() method). |
void |
removeBack()
Removes the last node from this Path. |
void |
removeFront()
Removes the first node from this Path (O(length)). |
java.lang.String |
toString()
Returns a String representation of this path. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Path()
public Path(int i, int j)
i
,j
).
i
- first node of the Pathj
- second node of the Pathpublic Path(int[] apath)
apath[0]->..->apath[apath.length-1]
.
apath
- the nodes of the Path as an arrayprotected Path(java.util.ArrayList nodes)
nodes
- the ArrayList around which a Path has to be wrappedMethod Detail |
public int length()
public int nodeAt(int d)
d
from the startnode
of this Path.
d
- the distance (within the Path)
public void addBack(int node)
node
to the end of this Path.
node
- the node to be added to the backpublic void addFront(int node)
node
to the end of this Path (O(length)).
node
- the node to be added to the frontpublic void removeBack()
public void removeFront()
public void append(Path p)
p
to this path where appropriate.
Appending to the back is more efficient.
p
- the Path to be appendedpublic Path concat(Path p)
p
as a new Path object.
p
- the Path to be concatenated with this Path
public boolean isCanonical()
public int[] intersection(Path p)
p
- the path to be intersected with this Path
public NodeIterator first()
NodeIterator
,
NodeIterator.next()
public NodeIterator last()
NodeIterator
,
NodeIterator.previous()
public NodeIterator nodeIterator(int node)
node
- the node to be returned by the first
NodeIterator.next() of the returned
NodeIterator
node
by the
first NodeIterator.next() call.NodeIterator
,
NodeIterator.next()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |