flow = "router" docs = "DESCRIPTION.md" [[process]] source = "context://stdio/readline" [[connection]] from = "readline/json" to = "accumulate_triples/values" [[process]] alias = "accumulate_triples" source = "lib://flowstdlib/data/accumulate" input.partial = { once = [] } input.chunk_size = { always = 3 } # Loop back the partial arrays [[connection]] from = "accumulate_triples/partial" to = "accumulate_triples/partial" # Track top path to 'A' points [[process]] alias = "A_tracker" source = "path_tracker" input.forward_route = { once = "" } input.forward_distance = { once = 0 } input.other_route = { once = "" } input.other_distance = { once = 0 } input.forward_string = { always = "A" } input.cross_string = { always = "BC" } [[connection]] # A - top distance from = "accumulate_triples/chunk/0" to = "A_tracker/forward" [[connection]] # B - bottom distance from = "accumulate_triples/chunk/1" to = "A_tracker/other" [[connection]] # C - cross-over distance from = "accumulate_triples/chunk/2" to = "A_tracker/cross" # Track top path to 'B' points [[process]] alias = "B_tracker" source = "path_tracker" input.forward_route = { once = "" } input.forward_distance = { once = 0 } input.forward_string = { always = "B" } input.cross_string = { always = "C" } input.other = { always = 0 } [[connection]] # B - bottom distance from = "accumulate_triples/chunk/1" to = "B_tracker/forward" [[connection]] # C - cross-over distance from = "accumulate_triples/chunk/2" to = "B_tracker/cross" [[connection]] from = "A_tracker/route" to = "A_tracker/forward_route" [[connection]] from = "B_tracker/route" to = "B_tracker/forward_route" [[connection]] from = "A_tracker/distance" to = "A_tracker/forward_distance" [[connection]] from = "B_tracker/distance" to = "B_tracker/forward_distance" [[connection]] from = "A_tracker/route" to = "B_tracker/other_route" [[connection]] from = "B_tracker/route" to = "A_tracker/other_route" [[connection]] from = "A_tracker/distance" to = "B_tracker/other_distance" [[connection]] from = "B_tracker/distance" to = "A_tracker/other_distance" # combine the distance and route into a line [[connection]] from = "A_tracker/route" to = "append/s1" [[connection]] from = "A_tracker/distance" to = "to_string" [[process]] source = "lib://flowstdlib/fmt/to_string" [[connection]] from = "to_string" to = "append/s2" [[process]] source = "lib://flowstdlib/data/append" ######## Print out the shortest route and it's length to each point 'A' - and the last one is the destination [[connection]] from = "append" to = "stdout" [[process]] source = "context://stdio/stdout"