|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--PathGenerator
Class that generates all shortest paths for a given Graph. The shortest paths can be made cyclic canonical for the purpose of cycle generation. The PathGenerator object is always in sync with the Graph object by using the ChangeListener to regenerate Paths on demand.
Graph
,
Path
,
Cycle
Constructor Summary | |
PathGenerator(Graph g)
Constructs a new PathGenerator for the graph g . |
Method Summary | |
int |
diameter()
Returns the diameter of the Graph. |
int |
distance(int i,
int j)
Returns the distance between the nodes i and
j . |
static void |
main(java.lang.String[] args)
Program which prints all shortest paths (not cyclic canonical) to the screen of the YutsisGraph specified by the first argument. |
void |
makeCanonical()
Only the Path's wich passes nodes bigger than the start node will remain. |
java.util.ArrayList |
paths(int i,
int j)
Returns a vector of shortest paths between i and
j |
void |
stateChanged(javax.swing.event.ChangeEvent e)
Implementation of the ChangeListener interface. |
java.lang.String |
toString()
Returns a String representation of this PathGenerator. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PathGenerator(Graph g)
g
.
g
- the Graph for which shortest paths have to be
generatedGraph
Method Detail |
public java.util.ArrayList paths(int i, int j)
i
and
j
i
- first node for which all Path's have to be returnedj
- second node for which all Path's have to be returnedPath
public int distance(int i, int j)
i
and
j
. A distance equal to the Graph's order
(original nr of nodes) has to be regarded as infinity.
i
- first node for which the distance has to be returnedj
- second node for which the distance has to be returned
Graph
public void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
public void makeCanonical()
Path
,
Cycle
public int diameter()
Graph
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
Graph
,
YutsisGraph
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |