Find shortest path between two articles in english Wikipedia in Python

后端 未结 2 652
天涯浪人
天涯浪人 2021-02-14 00:43

The question:

Find shortest path between two articles in english Wikipedia. Path between article A and B exist if there are articles C(i) and there is a

2条回答
  •  时光说笑
    2021-02-14 01:29

    We are looking at graph exploration... why should you be considering Dijkstra's algorithm??? IMHO... change the approach.

    First, you need a good heuristic function. For every node you expand, you need to geusstimate the distance of that node from the target/goal node. Now... how you compute the heuristic is the real challenge here. You may perhaps do a keyword mapping between the current wiki page and your destination page. A percentage of match may give you the estimate. Or... try to guess the relevance of content between the two pages. I have a hunch... perhaps a Neural Network may help you here. But, this may not indicate optimal estimate either. I'm not sure. Once you figure out a suitable way of doing this, use A* search algorithm.

    Search and explore the heuristic function, do not go for breadth first search, you'll end up no where in the vast wide world of wikipedia!

提交回复
热议问题