From 37a7d2350a6734d12b853432c0ab6db922258108 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Tue, 14 Jan 2025 15:14:24 +0000 Subject: [PATCH] strm typos -> srtm --- .../DirectedGraph.java | 0 .../GraphCycleCFinder/#SRTM_Depth.java# | 121 ++++++++++++++++++ .../example/GraphCycleCFinder/#temp.java# | 118 +++++++++++++++++ .../example/GraphCycleCFinder/SRTM_Depth.java | 118 +++++++++++++++++ .../example/GraphIndexTree/SRTM_Child.java | 4 +- .../example/GraphIndexTree/SRTM_Diagonal.java | 6 +- .../javac\360\237\226\211/Ariadne_Label.java" | 1 + 7 files changed, 363 insertions(+), 5 deletions(-) rename developer/{example/GraphCycleCFinder => deprecated}/DirectedGraph.java (100%) create mode 100644 developer/example/GraphCycleCFinder/#SRTM_Depth.java# create mode 100644 developer/example/GraphCycleCFinder/#temp.java# create mode 100644 developer/example/GraphCycleCFinder/SRTM_Depth.java diff --git a/developer/example/GraphCycleCFinder/DirectedGraph.java b/developer/deprecated/DirectedGraph.java similarity index 100% rename from developer/example/GraphCycleCFinder/DirectedGraph.java rename to developer/deprecated/DirectedGraph.java diff --git a/developer/example/GraphCycleCFinder/#SRTM_Depth.java# b/developer/example/GraphCycleCFinder/#SRTM_Depth.java# new file mode 100644 index 0000000..78de5f7 --- /dev/null +++ b/developer/example/GraphCycleCFinder/#SRTM_Depth.java# @@ -0,0 +1,121 @@ +/* +SRTM_Depth is a list of neighbor SRTMs going down the leftmost side of +a graph traversal. A leftmost traversal is one characterized by +following leftmost not yet visited node on the most recently visited +node's neighbor list. + +Depth traversal from a start node, ends when reaching a node that has +no neighbors, or when reaching encountering a cycle. + +The `Node::neighbor()` function returns an SRTM for iterating over the +node's neighbors. An SRTM is returned rather than a list, because in +general a neighbor list is allowed to be unbounded. Though with a +finite graph, that can not happen. (See IndexTree for an example of an +infinite depth and infinite breadth graph traveral.) + +It is possible to construct and infinite graph such that the +`SRTM_Depth::make()` function would never return. + +For a finite graph, this depth traversal will provably terminate, due +to running out unique (non cycle) nodes to visit. More generally, if +graph traversal from a start node is guaranteed to reach a leaf node +(has no neighbors), or a a cycle, within a finite number of node +traversal steps, then `SRTM_Depth::make()` will always return. + +Each call to step causes the TM read head to move to the next lowest +depth, leftmost unvisited node. This might require backtracking and +descending again. + +Nodes are referenced by label. + +A null valued label is flagged as an error, though we still look it up +in the graph. It is a fatal error, `exit(1)` if `lookup` returns a +null node. + +A path is a list of nodes found while traversing a tree. A road is a +list of child_srtm found while traversing the tree. + +*/ + +import com.ReasoningTechnology.Ariadne.Ariadne_SRTM; +import com.ReasoningTechnology.Ariadne.Ariadne_Graph; + + +class SRTM_Depth{ + + // static + // + + PathStack make(Graph g){ + return new SRTM_Depth(g); + } + + // instance data + // + protected List path; + protected Graph graph; + + // constructor + // + protected SRTM_Depth(Graph g){ + set_topography(topo_null); + if(g == null) return; + graph = g; + path.add( g.start() ); + descend(); + } + + // instance interface implementation + // + + + // A path is terminated by a leaf node or discovering a cycle. + protected boolean extend_path_to_termination(){ + + ArrayList