Find shortest path between two articles in english Wikipedia in Python

后端 未结 2 657
天涯浪人
天涯浪人 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:33

    Given the number of articles on wikipedia, it would take a unaffordable time to compute THE shortest (my assumption - I haven't tried).

    The real problem is to find an acceptable and efficent short path between two articles.

    Algorithms that deal with this kind problem are related to The travelling salesman problem. It could be a good point to start from.

    IIRC google or yahoo bots use Ant Colony Optimization to get the shortest acceptable in optimized time. You could check this SO question: Where can I learn more about "ant colony" optimizations?

    I'm personnally also fond of the genetic algorithms approach to find an acceptable optimum in a certain amount of time.


    I have just looked at that image and that sets the number of articles to 4.000.000 for en.wikipedia.com in 2013. Much less than I thought indeed.

    EDIT: I first stated it was a NP-Hard problem and commenters explain it's not.

提交回复
热议问题