-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Spaces Graph Dijkstra SPF Shell (1) - Spaces Graph Dijkstra SPF Topography (2) - Spaces Graph Dijkstra SPF Constructor (3, 4) - Topology Graph Connection Map #1 (5, 6) - Spaces Graph Topography Adjacent Distance (7, 8) - Topology Graph Connection Map #2 (9, 10, 11) - Spaced Graph Dijksra Wengert Shell (13) - Topology Graph Connection Map #3 (14) - Dijkstra Wengert Node Visitation Wengert (15) - Dijkstra Wengert Cross Connection Map (16) - Dijkstra Wengert Constructor and Annotation (17, 18, 19) - Dijkstra Wengert Graph Standard #1 (20, 21) - Dijkstra Wengert Graph Standard #2 (22, 23) - Spaces Graph Dijkstra Scheme Initialization (24) - Dijkstra Wengert Graph - Navigation Complete (25, 26) - Dijkstra Scheme Adjacent Scan #1 (27, 28) - Dijkstra Scheme Adjacent Scan #2 (29, 30) - Dijkstra Scheme Adjacent Scan #3 (31, 32) - Dijkstra Wengert Set Node Visited (33, 34) - Dijkstra Scheme Adjacent Scan #4 (35, 36) - Dijkstra Scheme Adjacent Scan #5 (37, 38) - Dijkstra Scheme Adjacent Scan #6 (39, 40) - Dijkstra Wengert Node Visitation Check (45, 46) - Dijkstra Scheme Adjacent Scan #7 (47, 48) - Dijkstra Scheme Adjacent Scan #8 (49, 50) - Dijkstra Scheme Adjacent Scan #9 (51, 52) - Dijkstra Scheme Adjacent Scan #10 (53, 54) - Dijkstra Scheme Adjacent Scan #11 (55, 56) - Dijkstra Scheme Adjacent Scan #12 (57, 58) - Dijkstra Scheme Adjacent Scan #13 (59, 60) Bug Fixes/Clean-up: - Spaces Graph Dijkstra Scheme Rename (12) Samples: - Dijkstra Algorithm Graph #1 (41, 42) - Dijkstra Algorithm Graph #2 (43, 44)
- Loading branch information
1 parent
a48f5b0
commit d623cf5
Showing
5 changed files
with
773 additions
and
1 deletion.
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,44 @@ | ||
|
||
Features: | ||
|
||
- Spaces Graph Dijkstra SPF Shell (1) | ||
- Spaces Graph Dijkstra SPF Topography (2) | ||
- Spaces Graph Dijkstra SPF Constructor (3, 4) | ||
- Topology Graph Connection Map #1 (5, 6) | ||
- Spaces Graph Topography Adjacent Distance (7, 8) | ||
- Topology Graph Connection Map #2 (9, 10, 11) | ||
- Spaced Graph Dijksra Wengert Shell (13) | ||
- Topology Graph Connection Map #3 (14) | ||
- Dijkstra Wengert Node Visitation Wengert (15) | ||
- Dijkstra Wengert Cross Connection Map (16) | ||
- Dijkstra Wengert Constructor and Annotation (17, 18, 19) | ||
- Dijkstra Wengert Graph Standard #1 (20, 21) | ||
- Dijkstra Wengert Graph Standard #2 (22, 23) | ||
- Spaces Graph Dijkstra Scheme Initialization (24) | ||
- Dijkstra Wengert Graph - Navigation Complete (25, 26) | ||
- Dijkstra Scheme Adjacent Scan #1 (27, 28) | ||
- Dijkstra Scheme Adjacent Scan #2 (29, 30) | ||
- Dijkstra Scheme Adjacent Scan #3 (31, 32) | ||
- Dijkstra Wengert Set Node Visited (33, 34) | ||
- Dijkstra Scheme Adjacent Scan #4 (35, 36) | ||
- Dijkstra Scheme Adjacent Scan #5 (37, 38) | ||
- Dijkstra Scheme Adjacent Scan #6 (39, 40) | ||
- Dijkstra Wengert Node Visitation Check (45, 46) | ||
- Dijkstra Scheme Adjacent Scan #7 (47, 48) | ||
- Dijkstra Scheme Adjacent Scan #8 (49, 50) | ||
- Dijkstra Scheme Adjacent Scan #9 (51, 52) | ||
- Dijkstra Scheme Adjacent Scan #10 (53, 54) | ||
- Dijkstra Scheme Adjacent Scan #11 (55, 56) | ||
- Dijkstra Scheme Adjacent Scan #12 (57, 58) | ||
- Dijkstra Scheme Adjacent Scan #13 (59, 60) | ||
|
||
|
||
Bug Fixes/Clean-up: | ||
|
||
- Spaces Graph Dijkstra Scheme Rename (12) | ||
|
||
|
||
Samples: | ||
|
||
- Dijkstra Algorithm Graph #1 (41, 42) | ||
- Dijkstra Algorithm Graph #2 (43, 44) |
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,200 @@ | ||
|
||
package org.drip.sample.graph; | ||
|
||
import org.drip.service.env.EnvManager; | ||
import org.drip.spaces.graph.DijkstraScheme; | ||
import org.drip.spaces.graph.Topography; | ||
|
||
/* | ||
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
*/ | ||
|
||
/*! | ||
* Copyright (C) 2018 Lakshmi Krishnamurthy | ||
* | ||
* This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model | ||
* libraries targeting analysts and developers | ||
* https://lakshmidrip.github.io/DRIP/ | ||
* | ||
* DRIP is composed of four main libraries: | ||
* | ||
* - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/ | ||
* - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/ | ||
* - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/ | ||
* - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/ | ||
* | ||
* - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options, | ||
* Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA | ||
* Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV | ||
* Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM | ||
* Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics. | ||
* | ||
* - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy | ||
* Incorporator, Holdings Constraint, and Transaction Costs. | ||
* | ||
* - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality. | ||
* | ||
* - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Dijkstra illustrates the Execution of the Dijkstra Algorithm. The References are: | ||
* | ||
* 1) Wikipedia (2018a): Graph (Abstract Data Type) | ||
* https://en.wikipedia.org/wiki/Graph_(abstract_data_type). | ||
* | ||
* 2) Wikipedia (2018b): Graph Theory https://en.wikipedia.org/wiki/Graph_theory. | ||
* | ||
* 3) Wikipedia (2018c): Graph (Discrete Mathematics) | ||
* https://en.wikipedia.org/wiki/Graph_(discrete_mathematics). | ||
* | ||
* 4) Wikipedia (2018d): Dijkstra's Algorithm https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm. | ||
* | ||
* 5) Wikipedia (2018e): Bellman-Ford Algorithm | ||
* https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm. | ||
* | ||
* @author Lakshmi Krishnamurthy | ||
*/ | ||
|
||
public class Dijkstra | ||
{ | ||
|
||
private static final Topography SetTopography() | ||
throws Exception | ||
{ | ||
String[] vertexNodeArray = new String[] | ||
{ | ||
// "Delhi ", | ||
// "Bombay ", | ||
"Madras ", | ||
"Calcutta ", | ||
"Bangalore ", | ||
// "Hyderabad ", | ||
// "Cochin ", | ||
// "Pune ", | ||
// "Ahmedabad ", | ||
// "Jaipur " | ||
}; | ||
|
||
Topography topography = new Topography(); | ||
|
||
for (String vertexNodeName : vertexNodeArray) | ||
{ | ||
topography.addVertexNode (vertexNodeName); | ||
} | ||
|
||
/* topography.addPath ( | ||
vertexNodeArray[0], // Delhi | ||
vertexNodeArray[1], // Bombay | ||
1388. | ||
); | ||
topography.addPath ( | ||
vertexNodeArray[0], // Delhi | ||
vertexNodeArray[2], // Madras | ||
2191. | ||
); | ||
topography.addPath ( | ||
vertexNodeArray[1], // Bombay | ||
vertexNodeArray[2], // Madras | ||
1279. | ||
); | ||
topography.addPath ( | ||
vertexNodeArray[0], // Delhi | ||
vertexNodeArray[3], // Calcutta | ||
1341. | ||
); | ||
topography.addPath ( | ||
vertexNodeArray[1], // Bombay | ||
vertexNodeArray[3], // Calcutta | ||
1968. | ||
); */ | ||
|
||
topography.addPath ( | ||
vertexNodeArray[0], // Madras | ||
vertexNodeArray[1], // Calcutta | ||
// vertexNodeArray[2], // Madras | ||
// vertexNodeArray[3], // Calcutta | ||
1663. | ||
); | ||
|
||
topography.addPath ( | ||
vertexNodeArray[0], // Madras | ||
vertexNodeArray[2], // Bangalore | ||
// vertexNodeArray[2], // Madras | ||
// vertexNodeArray[4], // Bangalore | ||
361. | ||
); | ||
|
||
/* topography.addPath ( | ||
vertexNodeArray[2], // Madras | ||
vertexNodeArray[5], // Hyderabad | ||
784. | ||
); | ||
topography.addPath ( | ||
vertexNodeArray[2], // Madras | ||
vertexNodeArray[6], // Cochin | ||
697. | ||
); | ||
topography.addPath ( | ||
vertexNodeArray[1], // Bombay | ||
vertexNodeArray[7], // Pune | ||
192. | ||
); | ||
topography.addPath ( | ||
vertexNodeArray[1], // Bombay | ||
vertexNodeArray[8], // Ahmedabad | ||
492. | ||
); | ||
topography.addPath ( | ||
vertexNodeArray[0], // Delhi | ||
vertexNodeArray[9], // Jaipur | ||
308. | ||
); */ | ||
|
||
return topography; | ||
} | ||
|
||
public static void main ( | ||
final String[] inputArray) | ||
throws Exception | ||
{ | ||
EnvManager.InitEnv (""); | ||
|
||
Topography topography = SetTopography(); | ||
|
||
String source = "Bangalore "; | ||
String destination = "Calcutta "; | ||
|
||
DijkstraScheme dijkstraScheme = new DijkstraScheme (topography); | ||
|
||
System.out.println ( | ||
dijkstraScheme.spf ( | ||
source, | ||
destination | ||
) | ||
); | ||
|
||
EnvManager.TerminateEnv(); | ||
} | ||
} |
Oops, something went wrong.