Create a weighted graph and tests shown below:
- This class implements the interface of a NodeData. It holds a int key for uniqe ID and his location.
- GeoLocation location for x,y,z coordinates for each node.
- double weight for cost (Initialized as 0 for all nodes).
- int tag for implementing algorithms.
- String info for holding information about the node as a string (If there was an entrance).
- This class implements the interface of an EdgeData. It holds two IDs, one for the source's ID and one for the destination's.
- double weight for the cost of going through from one side to the other side.
- This class holds 3 important HashMaps, one for nodes and one fromEdges and one for toEdges, also this class has 2 constructors:
toEdges and fromEdges works the same, The key it contains will determine the src and his value contents another HashMap that contains the target and the edge that connects them.
We create a graph from the previous class, and on that we will run the algorithm.
| G1 | G2 | G3 |
|---|---|---|
58.0015 ms |
93.9998 ms |
402.0016 ms |
| G1 | G2 | G3 |
|---|---|---|
True: 30.9984 ms |
True: 31.9981 ms |
True: 34.0002 ms |
| G1 | G2 | G3 |
|---|---|---|
28.9986 ms |
31.0006 ms |
33.9988 ms |
| G1 | G2 | G3 |
|---|---|---|
45.0005 |
42.9983 |
74.9971 |
Clone the project
git clone https://github.com/GoelDidi/OOP_Ex2.gitGo to the project directory
cd OOP_Ex2Run the program
java -jar Ex2.jar G1.json




