-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de6e450
commit 4ef794b
Showing
9 changed files
with
421 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Path Finding Applications | ||
|
||
We are in the application layer, so we offer all the verticals for path finding, such as Dijkstra oin various forms, A*, Yens, you name it. | ||
|
||
And we package them in a neat facade so that we are easily used from e.g. the Neo4j integration layer. | ||
|
||
## Facade design | ||
|
||
We offer facades segmented by mode, e.g. writes or estimates. | ||
Because these facades are the top level thing in the path finding segment of this layer, | ||
we should make it very useful and usable. That is their purpose. | ||
A single dependency that grants access. | ||
|
||
We should capture reuse here that different UIs need. Neo4j Procedures coming in, maybe Arrow, let's make life easy for them. | ||
|
||
Concretely, we have UI layers inject result rendering as that is bespoke. We delegate downwards for the actual computations. | ||
|
||
Importantly, each segment-facade decides which, if any, mutate or write hooks need to be injected. We pick those from a catalog since they are all the same - relationship-centric for path finding. |
29 changes: 29 additions & 0 deletions
29
...ding/src/main/java/org/neo4j/gds/applications/algorithms/pathfinding/AlgorithmLabels.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.gds.applications.algorithms.pathfinding; | ||
|
||
/** | ||
* We need human-readable labels for e.g. progress tracking | ||
*/ | ||
interface AlgorithmLabels { | ||
String A_STAR = "AStar"; | ||
String DIJKSTRA = "Dijkstra"; | ||
String YENS = "Yens"; | ||
} |
246 changes: 0 additions & 246 deletions
246
...rg/neo4j/gds/applications/algorithms/pathfinding/PathFindingAlgorithmsBusinessFacade.java
This file was deleted.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
...pplications/algorithms/pathfinding/PathFindingAlgorithmsEstimationModeBusinessFacade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.gds.applications.algorithms.pathfinding; | ||
|
||
import org.neo4j.gds.AlgorithmMemoryEstimateDefinition; | ||
import org.neo4j.gds.config.AlgoBaseConfig; | ||
import org.neo4j.gds.paths.SourceTargetShortestPathBaseConfig; | ||
import org.neo4j.gds.paths.astar.AStarMemoryEstimateDefinition; | ||
import org.neo4j.gds.paths.astar.config.ShortestPathAStarBaseConfig; | ||
import org.neo4j.gds.paths.dijkstra.DijkstraMemoryEstimateDefinition; | ||
import org.neo4j.gds.paths.yens.YensMemoryEstimateDefinition; | ||
import org.neo4j.gds.paths.yens.config.ShortestPathYensBaseConfig; | ||
import org.neo4j.gds.results.MemoryEstimateResult; | ||
|
||
/** | ||
* Here is the top level business facade for all your path finding memory estimation needs. | ||
* It will have all pathfinding algorithms on it, in estimate mode. | ||
*/ | ||
public class PathFindingAlgorithmsEstimationModeBusinessFacade { | ||
private final AlgorithmEstimationTemplate algorithmEstimationTemplate; | ||
|
||
public PathFindingAlgorithmsEstimationModeBusinessFacade(AlgorithmEstimationTemplate algorithmEstimationTemplate) { | ||
this.algorithmEstimationTemplate = algorithmEstimationTemplate; | ||
} | ||
|
||
public MemoryEstimateResult singlePairShortestPathAStarEstimate( | ||
ShortestPathAStarBaseConfig configuration, | ||
Object graphNameOrConfiguration | ||
) { | ||
return runEstimation(new AStarMemoryEstimateDefinition(), configuration, graphNameOrConfiguration); | ||
} | ||
|
||
public MemoryEstimateResult singlePairShortestPathDijkstraEstimate( | ||
SourceTargetShortestPathBaseConfig configuration, | ||
Object graphNameOrConfiguration | ||
) { | ||
return runEstimation(new DijkstraMemoryEstimateDefinition(), configuration, graphNameOrConfiguration); | ||
} | ||
|
||
public MemoryEstimateResult singlePairShortestPathYensEstimate( | ||
ShortestPathYensBaseConfig configuration, | ||
Object graphNameOrConfiguration | ||
) { | ||
return runEstimation(new YensMemoryEstimateDefinition(), configuration, graphNameOrConfiguration); | ||
} | ||
|
||
private <CONFIGURATION extends AlgoBaseConfig> MemoryEstimateResult runEstimation( | ||
AlgorithmMemoryEstimateDefinition<CONFIGURATION> memoryEstimateDefinition, | ||
CONFIGURATION configuration, | ||
Object graphNameOrConfiguration | ||
) { | ||
var memoryEstimation = memoryEstimateDefinition.memoryEstimation(configuration); | ||
|
||
return algorithmEstimationTemplate.estimate( | ||
configuration, | ||
graphNameOrConfiguration, | ||
memoryEstimation | ||
); | ||
} | ||
} |
Oops, something went wrong.