Severity: Warning
Message: fopen(/tmp/ci_sessionldqkoleo7hbvfqhd5gk5f8necvvnt6k7): failed to open stream: No space left on device
Filename: drivers/Session_files_driver.php
Line Number: 176
Backtrace:
File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct
File: /var/www/html/index.php
Line: 311
Function: require_once
Severity: Warning
Message: session_start(): Failed to read session data: user (path: /tmp)
Filename: Session/Session.php
Line Number: 143
Backtrace:
File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct
File: /var/www/html/index.php
Line: 311
Function: require_once
By PRIYA KUMARI
Given module calculates the minimum spanning tree for a graph using Prim's algorithm. This algorithm is implemented using heapq module.
-->Description of Graph class :- The graph class of creates an adjacency list.
Description of addEdge(self,u,v,w):- This method stores the new vertices and edges, where u and v are the starting and ending vertices and w is the weight of the edges between these vertices.
Description of method prims(g) :- This method takes argument as g which is our graph, and then uses the prims algorithm to find the minimum spanning tree for the graph.
This algorithm is implemented using heap. The time complexity of this algorithm is O(v log e), where v is the number of vertices and e is the number of edges.
-->How to use the packet.
Import the prims module to your program
1) Enter the value of u,v, and w
2) Pass the value of u,v and w into the method addEdge and call the prims method, it will find the minimum spanning tree of the graph class.
Code
Output

Submitted by PRIYA KUMARI (priyaCode25)
Download packets of source code on Coders Packet
Comments