2019-02-02 10:18:57 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
|
|
|
|
from cache import get_cache
|
|
|
|
from receive import receive_links, receive_link_graph
|
|
|
|
|
2019-02-02 15:06:57 +00:00
|
|
|
from dijkstra import prepare_dijkstra, dijkstra
|
2019-02-15 10:47:50 +00:00
|
|
|
from connectivity import shortest_path
|
2019-02-02 15:06:57 +00:00
|
|
|
|
2019-02-21 16:14:17 +00:00
|
|
|
from graph import DijkstraHelper
|
|
|
|
from db_util import get_page_id
|
|
|
|
|
2019-02-02 15:06:57 +00:00
|
|
|
cache = get_cache("./cache/", "Angela_Merkel")
|
|
|
|
receive_link_graph("Angela_Merkel", cache, 2)
|
|
|
|
|
|
|
|
cursor = cache.cursor()
|
|
|
|
cursor.execute("SELECT COUNT(source) FROM links")
|
|
|
|
print(cursor.fetchall())
|
|
|
|
|
2019-02-15 10:47:50 +00:00
|
|
|
#prepare_dijkstra(cache)
|
|
|
|
#dijkstra("Angela_Merkel", cache)
|
2019-02-21 16:14:17 +00:00
|
|
|
#
|
|
|
|
#print(shortest_path("Angela_Merkel", "Germany", cache))
|
|
|
|
|
|
|
|
|
|
|
|
angela = get_page_id("Angela_Merkel", cache)
|
2019-02-02 15:06:57 +00:00
|
|
|
|
2019-02-21 16:14:17 +00:00
|
|
|
dijkstra = DijkstraHelper.from_db(cache)
|
|
|
|
dijkstra.dijkstra(angela)
|
|
|
|
dijkstra.write_back(cache)
|
2019-02-25 13:23:09 +00:00
|
|
|
print({k:v for k,v in dijkstra._nodes.items() if v != float("inf")})
|