Differences
This shows you the differences between two versions of the page.
projs:clans:docs:sps [2014/01/20 14:08] yoyoliliu |
projs:clans:docs:sps [2014/01/28 03:26] (current) yoyoliliu |
||
---|---|---|---|
Line 5: | Line 5: | ||
====== Parameter ====== | ====== Parameter ====== | ||
URL: [[http://clans.cse.cuhk.edu.hk/clansV0.002/peopleServlet?type=shortestpath&pid1=1&pid2=2]] | URL: [[http://clans.cse.cuhk.edu.hk/clansV0.002/peopleServlet?type=shortestpath&pid1=1&pid2=2]] | ||
+ | |||
====== Return ====== | ====== Return ====== | ||
Json file: | Json file: | ||
+ | |||
+ | {{:projs:clans:docs:egp.jpg?600|}} | ||
+ | {{:projs:clans:docs:egc.jpg?600|}} | ||
+ | |||
====== Detail Information ====== | ====== Detail Information ====== | ||
- related modules:HTTPServer, BaseHTTPRequestHander, ThreadingMixIn, urlParse | - related modules:HTTPServer, BaseHTTPRequestHander, ThreadingMixIn, urlParse | ||
- MySQLdb:[[https://pypi.python.org/pypi/MySQL-python]] | - MySQLdb:[[https://pypi.python.org/pypi/MySQL-python]] | ||
- networkx:[[https://pypi.python.org/pypi/networkx/]] | - networkx:[[https://pypi.python.org/pypi/networkx/]] | ||
- | |||
====== Function====== | ====== Function====== | ||
- | - Ordered List Item | + | - [[projs:clans:docs:sps:threadhttpserver.initdataset()]]: Create the social network and initial data set. |
- | ====== Flow Chat ====== | + | - [[projs:clans:docs:sps:threadhttpserver.getdata()]]: Get dataSet. |
+ | - [[projs:clans:docs:sps:threadhttpserver.getcompanydataset()]]: Get company information. | ||
+ | - [[projs:clans:docs:sps:handler.do_get()]] | ||
+ | - [[projs:clans:docs:sps:handler.calp(source,target)]]: Return the shortest from source to target in a weighted graph G. | ||
+ | - [[projs:clans:docs:sps:handler.calc(source,target)]]: Return the shortest path from source company to target company based on a weighted people social network. | ||
+ | - [[projs:clans:docs:sps:handler.writejson(path)]]: Return a json file shown on the website about shortest path from person to person. | ||
+ | - [[projs:clans:docs:sps:handler.writejson(cid1,cid2,pathlist)]]: Returns a json file shown on the website. It is list of shortest path from source company to target company. | ||
+ | |||
+ | ====== Implementation ====== | ||
+ | - Main idea: | ||
+ | - - call initDataset() as long as the server running | ||
+ | - - after data is ready, call do_GET() function when receives an URL request. | ||
+ | - - 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 |