图的操作与实现

/ 5,228评论 / 22310阅读 / 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. Let’s be honest, a superb manicure could make any girl really feel like she’s actually received her life collectively.

  2. There are a number of dance corporations in Flagstaff, together with Coconino Neighborhood School Dance Program, Northern Arizona Preparatory Company and Canyon Motion, which current periodic concerts and collaborate with the Flagstaff Symphony without cost concert events through the summer season and vacation seasons.

  3. That drop is far steeper than the nation total, which declined from 66 to 62, in line with the Bureau of Labor Statistics.

  4. I’d favor most social contacts to begin out with this negotiation – each participant has a possibility to inject vital/pressing topics, and only if each cross do you push more durable for a non-urgent discussion matter.

  5. ScottSunty说道:

    natural drugs for ed: canadian pharm 1st – what is the best ed pill

  6. While Crimson is the popular shade for performing any Pooja and for the married ladies in main occasions, multicolored dresses comparable to lengthy Kurtis, Anarkali, gowns, and Maxi dresses are in and anyone pairing them with good equipment can dazzle the gang.

  7. By tying a Swastik Rakhi, which is an emblem of excellent luck, fortune and prosperity sisters can make brothers feel particular and blessed.

  8. 借用 返却说道:

    David Jimenez translated this article to Spanish: WhatsApp y la domesticación de usuario.

  9. Mrs. Ruth Revels Hudgins, age 73, resident of Houston, Tex.,died Sunday Feb.

  10. porn说道:

    An interesting discussion is worth comment. I do believe that you should write more on this topic, it may not be a taboo subject but generally folks don’t speak about such topics. To the next! Kind regards.

  11. ThomasPor说道:

    causes for ed canadianpharm1st.com ed treatment drugs

  12. Carlosspart说道:

    drug medication: canadianpharm1st.com – ed meds pills drugs

  13. FrankAmurf说道:

    reasons for ed http://mexicanpharmeasy.com/# best online pharmacies in mexico

  14. peelerie.com说道:

    Excellent blog you’ve got here.. It’s difficult to find excellent writing like yours these days. I seriously appreciate individuals like you! Take care!!

  15. ScottSunty说道:

    purple pharmacy mexico price list: Pharm Easy – mexican mail order pharmacies

  16. Introducing to you the most prestigious online entertainment address today. Visit now to experience now!

  17. ThomasPor说道:

    india online pharmacy IndianPharmStar.com п»їlegitimate online pharmacies india

  18. FrankAmurf说道:

    psychological ed treatment https://mexicanpharmeasy.com/# mexican drugstore online

  19. ScottSunty说道:

    reputable indian pharmacies: indian pharmacy – best online pharmacy india

  20. Telegram下载说道:

    Can I just say what a comfort to uncover someone who truly knows what they’re discussing on the internet. You definitely understand how to bring a problem to light and make it important. A lot more people ought to read this and understand this side of your story. It’s surprising you are not more popular given that you certainly have the gift.

  21. ThomasPor说道:

    india pharmacy IndianPharmStar top 10 pharmacies in india

  22. ScottSunty说道:

    buying from online mexican pharmacy: mexican pharm easy – buying from online mexican pharmacy

  23. Kennethvorie说道:

    Федерация – это проводник в мир покупки запрещенных товаров, можно купить гашиш, купить кокаин, купить меф, купить экстази в различных городах. Москва, Санкт-Петербург, Краснодар, Владивосток, Красноярск, Норильск, Екатеринбург, Мск, СПБ, Хабаровск, Новосибирск, Казань и еще 100+ городов.

  24. Excellent entry. I thought the information extremely useful. Appreciated the way you detailed everything.

  25. FrankAmurf说道:

    ed cures that actually work https://indianpharmstar.com/# india pharmacy

  26. ThomasPor说道:

    mexico drug stores pharmacies mexican pharm easy mexican pharmaceuticals online

  27. ScottSunty说道:

    medication from mexico pharmacy: mexican pharm easy – mexico drug stores pharmacies

  28. Alternatively in Punjab the brides put on ivory and crimson bangles which can be known as chooda.

  29. Shop at online jewellery boutiques like GemLN India that provide haute couture impressed silver jewellery.

  30. The sport is performed on a 16×12 chessboard with each player in charge of two complete armies placed facet by facet.

  31. Absolutely they might easily overlook greater than I could ever be taught.

  32. 常套とは说道:

    Before diving deep, let’s understand some essential ideas about how product prices are accurately aligned and made accessible to focus on the customer segments.

  33. より他ない说道:

    He reminds me a little bit of Tim Sills and, if his transfer works out, he could assist Torquay get the ball up the pitch.

  34. A collar tugs on one area in a single course, whereas a harness tugs their complete chest and back space making it laborious on your French bulldog pup to inform what you want him to do.

  35. Never crossing international waters and catching the eye of foreigners.

  36. Benjamin, Jeff (March 13, 2015).

  37. There are numerous online corporations, who together with conference journey (konferensresa), organises leisure journeys comparable to football journeys and trips related to different video games, as well.

  38. A destination management company may arrange incentive travels like an occasion management firm.

  39. The subsequent day, the Battle of Lookout Mountain was fought, driving the Confederates off the mountain.

  40. GLUCO 6说道:

    Loved this article. It’s very comprehensive and packed with useful information. Great work!

  41. An ACM preliminary approval form (PAF) must be submitted so as to situation a call for papers.

  42. Tom Rousseau officiating. In an informal poll by the Norwegian Chess Federation in 1999, this game was voted to be the most effective Norwegian game.

  43. Why Choose Hickey Regulation Firm?

  44. You can completely arrange an event with out a profound program of vendor connections.

  45. The occasion ran 23 days, with a ticket price of $64.95.

  46. Girl beauty is incomplete without a jewel piece specially gold.

  47. On July 24, the Berks County Coroner workplace in Reading announced an autopsy revealed an area 26-day-previous female child that not too long ago died tested constructive for the virus and would investigate the demise as a co-sleeping accident.

发表回复

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