图的操作与实现

/ 1,297评论 / 5498阅读 / 0点赞

要求


源代码

若以下显示需要登录,请刷新页面或点击此处下载。


思考

若只求带权有向图G中从顶点i到顶点j的最短路径,如何修改Dijkstra 算法来实现这一功能?

void Dijkstra_way(int first_point)
{
	int* widget_list = new int[map_size];	//记录距离0的长度
	for (int i = map_size; i--;)
	{
		widget_list[i] = INF;
		adjList[i].weight = -1;
	}
	widget_list[first_point] = 0;
	adjList[first_point].weight = 0;
	for (int i = 1; i < map_size; ++i)
		for (int j = map_size; j--;)		//计算距离
			if (adjList[j].weight >= 0)
				for (node* node_p = adjList[j].next_p; node_p != NULL; node_p = node_p->next_p)
					if (widget_list[j] + node_p->weight < widget_list[node_p->data])
					{
						widget_list[node_p->data] = widget_list[j] + node_p->weight;
						adjList[node_p->data].weight = j;
					}
	cout << "<< Dijkstra 最短路径:" << endl;
	coolQueue<int> stack;
	for (int i = 0; i < map_size; ++i)
	{
		for (int j = i; j != first_point;)
		{
			stack.End_push(j);
			j = adjList[j].weight;
		}
		cout << "<< " << first_point;
		for (int pop_int = 0; stack.End_pop(pop_int);)
			cout << " -> " << pop_int;
		cout << endl;
		stack.clear();
	}
	adjList_reflush();
}
  1. RickyAlage说道:

    indian pharmacy online Cheapest online pharmacy indian pharmacy paypal

  2. Michaelsew说道:

    https://mexicoph24.life/# mexico pharmacies prescription drugs

  3. RickyAlage说道:

    top 10 online pharmacy in india indian pharmacy online shopping pharmacy india

  4. StevenSen说道:

    medication from mexico pharmacy: Mexican Pharmacy Online – buying prescription drugs in mexico

  5. Michaelsew说道:

    https://indiaph24.store/# buy medicines online in india

  6. RickyAlage说道:

    canadian pharmacy no rx needed canadian pharmacies canadian pharmacy 1 internet online drugstore

  7. RickyAlage说道:

    best online pharmacy india indian pharmacy online shopping pharmacy india

  8. StevenSen说道:

    my canadian pharmacy review: Certified Canadian Pharmacies – the canadian drugstore

  9. RickyAlage说道:

    canadian mail order pharmacy Licensed Canadian Pharmacy online canadian pharmacy

  10. Michaelsew说道:

    https://mexicoph24.life/# pharmacies in mexico that ship to usa

  11. RickyAlage说道:

    mexico drug stores pharmacies cheapest mexico drugs pharmacies in mexico that ship to usa

  12. RickyAlage说道:

    pharmacies in mexico that ship to usa mexico pharmacy buying prescription drugs in mexico online

  13. StevenSen说道:

    canadian online drugs: Prescription Drugs from Canada – canada drugs online review

  14. Michaelsew说道:

    http://canadaph24.pro/# best canadian pharmacy online

  15. RickyAlage说道:

    canadian drugs pharmacy Licensed Canadian Pharmacy best rated canadian pharmacy

  16. RickyAlage说道:

    indianpharmacy com Generic Medicine India to USA top 10 pharmacies in india

  17. Michaelsew说道:

    https://canadaph24.pro/# canadian pharmacy 365

  18. StevenSen说道:

    canadian online pharmacy: Certified Canadian Pharmacies – canada pharmacy

  19. RickyAlage说道:

    indian pharmacy paypal indian pharmacy india online pharmacy

  20. RickyAlage说道:

    mexican online pharmacies prescription drugs Online Pharmacies in Mexico mexican online pharmacies prescription drugs

  21. Michaelsew说道:

    https://mexicoph24.life/# п»їbest mexican online pharmacies

  22. RickyAlage说道:

    buy medicines online in india indian pharmacy fast delivery Online medicine home delivery

  23. LarryGok说道:

    PBN sites
    We shall establish a web of self-owned blog network sites!

    Merits of our privately-owned blog network:

    WE DO everything SO THAT Google doesn’t grasp THAT this A privately-owned blog network!!!

    1- We buy web domains from separate registrars

    2- The primary site is hosted on a VPS server (Virtual Private Server is fast hosting)

    3- The rest of the sites are on different hostings

    4- We assign a separate Google account to each site with confirmation in Google Search Console.

    5- We develop websites on WP, we do not utilise plugins with aided by which malware penetrate and through which pages on your websites are created.

    6- We don’t repeat templates and use only distinct text and pictures

    We don’t work with website design; the client, if wanted, can then edit the websites to suit his wishes

  24. RickyAlage说道:

    indian pharmacies safe Generic Medicine India to USA buy medicines online in india

  25. Michaelsew说道:

    https://mexicoph24.life/# buying from online mexican pharmacy

  26. RickyAlage说道:

    Online medicine order buy medicines online in india online pharmacy india

  27. RickyAlage说道:

    best online pharmacies in mexico Online Pharmacies in Mexico mexico pharmacies prescription drugs

  28. Michaelsew说道:

    http://canadaph24.pro/# best canadian pharmacy to buy from

  29. RickyAlage说道:

    best india pharmacy indian pharmacy best india pharmacy

  30. RickyAlage说道:

    mexican pharmacy reputable mexican pharmacies online buying prescription drugs in mexico online

  31. Michaelsew说道:

    http://canadaph24.pro/# rate canadian pharmacies

  32. RickyAlage说道:

    india pharmacy indian pharmacy india online pharmacy

  33. StevenSen说道:

    canadianpharmacymeds com: Large Selection of Medications from Canada – www canadianonlinepharmacy

  34. Chrisror说道:

    casino online uy tin web c? b?c online uy tin casino tr?c tuy?n uy tin

  35. Walteronerb说道:

    https://casinvietnam.com/# casino online uy tin

  36. JamesAnirm说道:

    http://casinvietnam.com/# casino tr?c tuy?n uy tin

  37. Chrisror说道:

    web c? b?c online uy tin choi casino tr?c tuy?n tren di?n tho?i choi casino tr?c tuy?n tren di?n tho?i

  38. Walteronerb说道:

    https://casinvietnam.com/# casino tr?c tuy?n uy tin

  39. Walteronerb说道:

    http://casinvietnam.shop/# casino tr?c tuy?n vi?t nam

  40. Chrisror说道:

    danh bai tr?c tuy?n casino tr?c tuy?n vi?t nam casino tr?c tuy?n uy tin

  41. JamesAnirm说道:

    https://casinvietnam.shop/# web c? b?c online uy tin

  42. Walteronerb说道:

    https://casinvietnam.com/# web c? b?c online uy tin

  43. Chrisror说道:

    game c? b?c online uy tin casino online uy tin casino tr?c tuy?n vi?t nam

  44. Walteronerb说道:

    https://casinvietnam.shop/# choi casino tr?c tuy?n tren di?n tho?i

  45. Chrisror说道:

    danh bai tr?c tuy?n casino tr?c tuy?n web c? b?c online uy tin

  46. Walteronerb说道:

    https://casinvietnam.com/# casino tr?c tuy?n uy tin

  47. Walteronerb说道:

    http://casinvietnam.shop/# web c? b?c online uy tin

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注