Well, first incarnation of the very first parse (that worked) is just for Li01, and it's a true "systems_shortest_path" - going via ANY connection at all.
li01,li01,li01
li01,li04,li01,li04
li01,li02,li01,li02
li01,li03,li01,li03
li01,iw03,li01,iw03
li01,li05,li01,li05
li01,iw01,li01,li04,iw01
li01,iw02,li01,li04,iw02
li01,iw04,li01,li02,iw04
li01,iw05,li01,li03,iw05
li01,iw06,li01,li03,iw06
li01,br02,li01,iw03,br02
li01,br04,li01,iw03,br04
li01,rh02,li01,li04,iw01,rh02
li01,ku02,li01,li03,iw05,ku02
li01,br01,li01,iw03,br02,br01
li01,br05,li01,iw03,br04,br05
li01,br03,li01,iw03,br04,br03
li01,br06,li01,iw03,br04,br06
li01,bw10,li01,iw03,br04,bw10
li01,rh04,li01,li04,iw01,rh02,rh04
li01,rh01,li01,li04,iw01,rh02,rh01
li01,ku01,li01,li03,iw05,ku02,ku01
li01,ku03,li01,li03,iw05,ku02,ku03
li01,bw02,li01,iw03,br04,br03,bw02
li01,bw01,li01,iw03,br04,br03,bw01
li01,bw08,li01,iw03,br04,bw10,bw08
li01,bw09,li01,iw03,br04,bw10,bw09
li01,rh05,li01,li04,iw01,rh02,rh04,rh05
li01,bw05,li01,li04,iw01,rh02,rh04,bw05
li01,rh03,li01,li04,iw01,rh02,rh01,rh03
li01,ku04,li01,li03,iw05,ku02,ku01,ku04
li01,ku05,li01,li03,iw05,ku02,ku01,ku05
li01,bw03,li01,iw03,br04,br03,bw02,bw03
li01,ew03,li01,iw03,br04,br03,bw02,ew03
li01,bw04,li01,iw03,br04,br03,bw02,bw04
li01,ew01,li01,iw03,br04,bw10,bw08,ew01
li01,bw07,li01,li04,iw01,rh02,rh04,bw05,bw07
li01,ku06,li01,li04,iw01,rh02,rh04,bw05,ku06
li01,bw06,li01,li04,iw01,rh02,rh04,bw05,bw06
li01,ku07,li01,li03,iw05,ku02,ku01,ku05,ku07
li01,ew04,li01,iw03,br04,br03,bw02,ew03,ew04
li01,hi02,li01,iw03,br04,br03,bw02,ew03,hi02
li01,hi01,li01,iw03,br04,bw10,bw08,ew01,hi01
li01,ew02,li01,li04,iw01,rh02,rh04,bw05,bw07,ew02
li01,ew06,li01,iw03,br04,br03,bw02,ew03,hi02,ew06
li01,ew05,li01,iw03,br04,bw10,bw08,ew01,hi01,ew05
Hmm, going to write another parser over the weekend that will compare the existing links, and see if this matches or not. Can't be arsed to visually verify the paths with existing ones.
I can switch between legal and illegal fairly simply. I do get an issue to current design when i start to iterate over all systems, but that's to do with how I am making "paths" so to speak.
Basically, it's
messy and probs very poor coding - any suggestions are welcome.
<pre><font size=1 face=Courier>
while(queue.peek()){ //check something actually is in queue before getting it!
try{
SSystem system = queue.getFront();//get from queue.
visited.add(system); //add it to visited (visited is a set, so duplicates are ignored).
System.out.println(system.getPath(original));
Set<SSystem> s = system.getShortest(); //set union of both legal and illegal, removes duplicates.
Iterator<SSystem> i = s.iterator();
while(i.hasNext()){
SSystem sts = i.next(); //get the system from collection
if(!visited.contains(sts)){ //check not visited...
sts.setParent(system); //sets the systems parent (from) system.
queue.addElement(sts); //add to queue
visited.add(sts); //add to visited, stops cockups.
}
}
} catch (Exception e){
System.out.println("Exiting due to exceptiohn"
;
System.exit(0);
}
}</font></pre>
Yeah, i know stacks are more associated with "peek", but since my "hasNext" is essentially a peek, I went with it as a name for the method
A few fills...
SSystem class has a "setParent" method... it's just a link to the parent system object that reached this current system. The reason for this is clear when calling the path out...
<pre><font size=1 face=Courier>public String getParents(){
if(parent == null){ //if no parent, starting system - return it's id (ie li01, or br01 etc).
return id;
}
return parent.getParents() + "," + id; //otherwise... recursion... but add your own system name to it.
}</font></pre>
<pre><font size=1 face=Courier>
public String getPath(String original){
return original + "," + id + "," + getParents();
}
</font></pre>
I know that it's probs got some "poor form" going on, but meh
The "original" is the original starting system... so in the starter, it's li01.
It does li01, then adds it's own system name (so for li01 itself... it'd add li01), and then does the "getParents method" - so will return li01 for the first system (being li01) - giving li01, li01, li01.
My problem in the design at first (erm, what design
Very poor form see!) is that it's got references littered to places all over! So to make this truly recursive, i have to quickly iterate over all systems and remove all links to parents etc... not an issue really, quite quick on modern comps
Any hints, thoughts, tips AND suggestions etc are welcome
I will post up all code if people are interested, the language is Java.