项目作者: atomb0mb
项目描述 :
Minimize the cost of building the connected highways by using graph theory and priority queue. The connected highways cannot be an acyclic or cycle.
高级语言: Java
项目地址: git://github.com/atomb0mb/TransportationManager.git
This project involves
- Vertex/Vertices
- Edge/Edges
- Adjacent list
- Disjoint-set/Union
- Heaps/Priority Queues
- Acyclic undirected graph
- Kruskal algorithm
Steps to find the minimum cost of connected highway (From Destination A to Destination B)
- Find all weighted edges (Find all vertices and caculate the weighted edge)
- Store all weighted edges Priority Queues (Minimum spanning tree)
- Dequeue the Priority Queues (The first will be the smallest or cheapest connection)
- Unions or subset the edges that did not have similar parent vertex or node. (To avoid cycle)
- Repeat untill the edges are connected to from destination A to destination B.