This is an old revision of the document!
Class ShortestPathServer
Collaborate with ZhangZhi
Description
a python server responses every URL request which contains 'shortestpath'. It returns a Json file shows the shortest path from source to target in a weighted graph G.
Parameter
Return
Json file:
Detail Information
- related modules:HTTPServer, BaseHTTPRequestHander, ThreadingMixIn, urlParse
Function
- ThreadHTTPServer.initDataset()
- ThreadHTTPServer.getData()
- ThreadHTTPServer.getCompanyDataSet()
- Handler.do_GET()
- Handler.calP(source,target)
- Handler.calC(source,target)
- Handler.writejson(path)
- Handler.writejson(cid1,cid2,pathList)
Flow Chat
- Main idea:
- - 1. call initDataset() as long as the server running
- - 2. after data is ready, call do_GET() function when receives an URL request.
- - 3. In do_GET() function, the main idea is: extract source pid and target pid,
then call Handler.calP(source,target) to get path list of pid, then call Handler.writejson(path) to generate json file. BaseHTTPRequestHandler.wfile.write(json file) to show result on browser.
- add flow chat here