@@ -1635,7 +1635,7 @@ function ProducingDotFiles(
16351635 # │ caller = ProducingDotFiles(testDFGAPI::Type{GraphsDFG}, v1::Nothing, v2::Nothing, f1::Nothing; VARTYPE::Type{VariableDFG}, FACTYPE::Type{FactorDFG}) at testBlocks.jl:1440
16361636 # └ @ Main ~/.julia/dev/DistributedFactorGraphs/test/testBlocks.jl:1440
16371637 addFactor! (dotdfg, f1)
1638- # NOTE hardcoded toDot will have different results so test Graphs seperately
1638+ # NOTE hardcoded toDot will have different results so test Graphs separately
16391639 if testDFGAPI <: GraphsDFG || testDFGAPI <: GraphsDFG
16401640 todotstr = DFG. toDot (dotdfg)
16411641 todota =
@@ -1862,8 +1862,8 @@ function PathFindingTests(testDFGAPI)
18621862 addFactor! (dfg, FactorDFG (:x1x3f1 , [:x1 , :x3 ], TestFunctorInferenceType1 ()))
18631863 addFactor! (dfg, FactorDFG (:x2x4f1 , [:x2 , :x4 ], TestFunctorInferenceType1 ()))
18641864
1865- # --- Basic getPaths / getPath (no restrictions) ---
1866- result = getPath (dfg, :x1 , :x3 )
1865+ # --- Basic findPaths / findPath (no restrictions) ---
1866+ result = findPath (dfg, :x1 , :x3 )
18671867 # shortest path should be via the direct link x1-x1x3f1-x3 (dist=2) not via x2 (dist=4)
18681868 @test result. path == [:x1 , :x1x3f1 , :x3 ]
18691869 @test result. dist == 2
@@ -1873,19 +1873,19 @@ function PathFindingTests(testDFGAPI)
18731873 # 2) x1-x1x3f1-x3-x3x4f1-x4 (dist=4)
18741874 # 3) x1-x1x2f1-x2-x2x3f1-x3-x3x4f1-x4 (dist=6)
18751875 # 4) x1-x1x3f1-x3-x2x3f1-x2-x2x4f1-x4 (dist=6)
1876- results = getPaths (dfg, :x1 , :x4 , 4 )
1876+ results = findPaths (dfg, :x1 , :x4 , 4 )
18771877 @test length (results) >= 2
18781878 @test results[1 ]. dist <= results[end ]. dist # sorted by distance
18791879
18801880 # path across the whole graph
1881- full_path = getPath (dfg, :x1 , :x10 )
1881+ full_path = findPath (dfg, :x1 , :x10 )
18821882 @test :x1 == first (full_path. path)
18831883 @test :x10 == last (full_path. path)
18841884
18851885 # --- Restrict with variableLabels only (all factors kept) ---
18861886 # Restrict to x1..x5 variables. Factors connecting only those vars are auto-included.
18871887 vars_subset = listVariables (dfg; typeFilter = == (TestVariableType1 ()))
1888- result_restricted = getPath (dfg, :x1 , :x5 ; variableLabels = vars_subset)
1888+ result_restricted = findPath (dfg, :x1 , :x5 ; variableLabels = vars_subset)
18891889 @test first (result_restricted. path) == :x1
18901890 @test last (result_restricted. path) == :x5
18911891 # x6..x10 should NOT appear on the path
@@ -1894,15 +1894,15 @@ function PathFindingTests(testDFGAPI)
18941894 # --- Restrict with factorLabels only (all variables kept) ---
18951895 # Only allow the first 4 factors, path x1→x5 should still work
18961896 facs_first4 = listFactors (dfg; labelFilter = contains (r" x[1-4](?!\d )" ))
1897- result_fac = getPath (dfg, :x1 , :x5 ; factorLabels = facs_first4)
1897+ result_fac = findPath (dfg, :x1 , :x5 ; factorLabels = facs_first4)
18981898 @test first (result_fac. path) == :x1
18991899 @test last (result_fac. path) == :x5
19001900
19011901 # --- Restrict with both variableLabels and factorLabels ---
19021902 vars_1to5 = listVariables (dfg; typeFilter = == (TestVariableType1 ()))
19031903 facs_1to4 = listFactors (dfg; labelFilter = contains (r" x[1-4](?!\d )" ))
19041904 result_both =
1905- getPath (dfg, :x1 , :x5 ; variableLabels = vars_1to5, factorLabels = facs_1to4)
1905+ findPath (dfg, :x1 , :x5 ; variableLabels = vars_1to5, factorLabels = facs_1to4)
19061906 @test first (result_both. path) == :x1
19071907 @test last (result_both. path) == :x5
19081908
@@ -1911,16 +1911,21 @@ function PathFindingTests(testDFGAPI)
19111911 solvable_vars = listVariables (dfg; solvableFilter = >= (1 ))
19121912 solvable_facs = listFactors (dfg; solvableFilter = >= (1 ))
19131913 # Path from x1 to x7 should work (all solvable)
1914- result_solvable =
1915- getPath (dfg, :x1 , :x7 ; variableLabels = solvable_vars, factorLabels = solvable_facs)
1914+ result_solvable = findPath (
1915+ dfg,
1916+ :x1 ,
1917+ :x7 ;
1918+ variableLabels = solvable_vars,
1919+ factorLabels = solvable_facs,
1920+ )
19161921 @test first (result_solvable. path) == :x1
19171922 @test last (result_solvable. path) == :x7
19181923 # x8 and x9 (unsolvable) should not appear
19191924 @test :x8 ∉ result_solvable. path
19201925 @test :x9 ∉ result_solvable. path
19211926
19221927 # Path from x1 to x10 with solvable filter should fail (x8, x9, x7x8f1 block the way)
1923- paths_blocked = getPaths (
1928+ paths_blocked = findPaths (
19241929 dfg,
19251930 :x1 ,
19261931 :x10 ,
@@ -1930,13 +1935,15 @@ function PathFindingTests(testDFGAPI)
19301935 )
19311936 @test isempty (paths_blocked)
19321937
1933- # And the singular getPath should throw on disconnect
1934- @test_throws ErrorException getPath (
1935- dfg,
1936- :x1 ,
1937- :x10 ;
1938- variableLabels = solvable_vars,
1939- factorLabels = solvable_facs,
1938+ # And the singular findPath should return nothing
1939+ @test isnothing (
1940+ findPath (
1941+ dfg,
1942+ :x1 ,
1943+ :x10 ;
1944+ variableLabels = solvable_vars,
1945+ factorLabels = solvable_facs,
1946+ ),
19401947 )
19411948
19421949 # --- With tagsFilter ---
@@ -1948,15 +1955,15 @@ function PathFindingTests(testDFGAPI)
19481955 @test :x4 ∈ landmark_vars
19491956 # Restrict to only LANDMARK variables - x1 is not a LANDMARK, so include it to enable the path
19501957 vars_with_x1 = union ([:x1 , :x2 ], landmark_vars)
1951- result_tags = getPath (dfg, :x1 , :x4 ; variableLabels = vars_with_x1)
1958+ result_tags = findPath (dfg, :x1 , :x4 ; variableLabels = vars_with_x1)
19521959 @test first (result_tags. path) == :x1
19531960 @test last (result_tags. path) == :x4
19541961 # x5..x10 should not be on this path
19551962 @test isempty (intersect (result_tags. path, [:x5 , :x6 , :x7 , :x8 , :x9 , :x10 ]))
19561963
1957- # --- getPaths with k > 1 on looped graph ---
1964+ # --- findPaths with k > 1 on looped graph ---
19581965 # With cross-links x1x3f1 and x2x4f1. Multiple paths exist from x1 to x4.
1959- results_multi = getPaths (dfg, :x1 , :x4 , 5 )
1966+ results_multi = findPaths (dfg, :x1 , :x4 , 5 )
19601967 @test length (results_multi) >= 2
19611968 # All paths should start at x1 and end at x4
19621969 for r in results_multi
@@ -1969,7 +1976,7 @@ function PathFindingTests(testDFGAPI)
19691976 # --- Error: no path exists ---
19701977 # Disconnect x10 by removing the factor
19711978 deleteFactor! (dfg, :x9x10f1 )
1972- @test_throws ErrorException getPath ( dfg, :x1 , :x10 )
1973- empty_paths = getPaths (dfg, :x1 , :x10 , 1 )
1979+ @test isnothing ( findPath ( dfg, :x1 , :x10 ) )
1980+ empty_paths = findPaths (dfg, :x1 , :x10 , 1 )
19741981 @test isempty (empty_paths)
19751982end
0 commit comments