Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 2.8 KB

README.md

File metadata and controls

60 lines (41 loc) · 2.8 KB

Ex2_OOP

About the Project:

This project represents the structure of a directed weighted graph, and run algorithms on it

‏‏לכידה

Directed Weighted Graphs_ans :

Represents the graph, and all the funcation it has- getNode, addNode, getEdge, connect (add new Edge), removeNode, removeEdge Nodes- an HashMapcontains all the Nodes (with all the data anout him) in the graph.
Edges- an HashMap contains all the Edges (with all the data anout him) in the graph. EdgesSize- the number of edges in the graph. NodesSize- the number of vertices in the graph.

NodaData:

represent the nodes in the graph.
Each node have:

  • key- id associated with this node.
  • Geolocation- location of this node
  • weight- he weight associated with this node
  • tag and info

EdgeData:

represent all the edges in the graph. Each edge have :

  • Src- The id of the source node of this edge.
  • Dest- The id of the destination node of this edge.
  • weight- the weight associated with this edge
  • tag and info

GeoLocation:

represent the location of (x,y,z), and distance between each teo of them.

Directed Weighted Graphs Algoritem :

This class resprents algoritems we can use on a Graph.

  • isConnected- check if the graph is connected. We with DFS algoritem on the original grahp, and the transpose graph. --> if equals, the graph is connected.
  • shortestPathDist- returns the shortest path between to nodes. We use dijkstra algoritem to find the shortestpath.
  • shortestPath- return a list of nodes, that represent the shortest path between to given node
  • center-
  • tsp- This method get list of vertices and computes a relatively short path which visit each node in the targets List.just a simple path going over all nodes in the list.
  • save- saves a graph to json file.
  • load- loads a graph from json to DirectedWeightedGraph_ans object.