楼主: 〇〇

一个求最短总路径的问题

[复制链接]
论坛徽章:
0
31#
发表于 2021-9-25 01:06 | 只看该作者
It is slow to learn new things when getting old.  I finally understand Dijkstra Algorithm after going over a detailed demonstration (like one shot to kill all birds).  So brute force backtracking approach for sudoku may do the same thing (as posted in new thread) for shortest path tree and probably for other related ones like traveler and shopping too.

But before forgetting following thought for current multiple traveler during Dijkstra algorithm learning process I would like to point out that sometimes even blind cat can catch dead rat.  So for 2 people why not shorten all possible sharable direct connections by half and then run Dijkstra algorithm to find a shortest path tree.  If lucky enough, one may find out both A and B are just on all the sharable paths (bingo!).  If not, it is still interesting to figure out why not and go further from there.

By the way, after understanding Dijkstra algorithm I am wondering if it can be implemented in sql (have not gone deep thinking on it).

使用道具 举报

回复
论坛徽章:
0
32#
发表于 2021-10-4 01:28 来自手机 | 只看该作者
Let me try again and see it gets through.  Basically, it does not have to be 50% for A and B on all sharable path.  One can set deferent ratios (from 0 to 100) on each sharable path.  Now it is really a partial random evolution approach like in even grouping problem.

使用道具 举报

回复
论坛徽章:
520
奥运会纪念徽章:垒球
日期:2008-09-15 01:28:12生肖徽章2007版:鸡
日期:2008-11-17 23:40:58生肖徽章2007版:马
日期:2008-11-18 05:09:48数据库板块每日发贴之星
日期:2008-11-29 01:01:02数据库板块每日发贴之星
日期:2008-12-05 01:01:03生肖徽章2007版:虎
日期:2008-12-10 07:47:462009新春纪念徽章
日期:2009-01-04 14:52:28数据库板块每日发贴之星
日期:2009-02-08 01:01:03生肖徽章2007版:蛇
日期:2009-03-09 22:18:532009日食纪念
日期:2009-07-22 09:30:00
33#
发表于 2021-10-4 23:16 | 只看该作者
jihuyao 发表于 2021-9-25 01:06
It is slow to learn new things when getting old.  I finally understand Dijkstra Algorithm after goin ...

我曾经见过有人写的用MODEL实现了Dijkstra算法。但是这个已经和传统SQL相差很远而且它的引用数组也不是真正的数组,效率差很多。SQL在算法实现中是没有优势的,只是某些情形下需要用到笛卡尔积时可能会少写一点代码。

使用道具 举报

回复
论坛徽章:
0
34#
发表于 2021-10-6 07:36 来自手机 | 只看该作者
Have not really think over the possibility but in the brute force backtracking code, each step can be completed in recursive sql and just not sure if deferent steps can be consolidated in one sql statement.  I can only say there is a chance here.

使用道具 举报

回复
论坛徽章:
0
35#
发表于 2021-10-6 07:43 来自手机 | 只看该作者
If can be implemented using model clause I would tend to believe it can be implemented in recursive sql.  Maybe it needs more than one thread, in odd step do one thing and in even step do another thing (2 steps represent 1 level only).

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表