目录
要求
- 图的邻接表和邻接矩阵存储
- 建立下图的邻接表或邻接矩阵,并输出之;
- 思路:
- 通过遍历邻接矩阵,采用头插法即可构造邻接表。
- 图的各种遍历算法实现
- 以0结点为起点实现上述图的深度优先和广度优先遍历算法;
- 思路:
- 用堆栈实现深度优先遍历,用队列实现广度优先遍历。
- 最小生成树的算法实现
- 利用普里姆(Prim)算法或克鲁斯卡尔(Kruskal)算法求上图的最小生成树,算法实现代码必需有注释。
- 思路:
- Prim:从0点出发每次取能到达的最小权重边,走完即为一颗最小生成树。
- 最短路径的算法实现
- 利用狄克斯特拉(Dijkstra)算法求上图中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();
}
You made some good points there. I checked on the web for additional information about the issue and found most people will go along with your views on this website.
Aw, this was an incredibly nice post. Taking the time and actual effort to produce a really good article… but what can I say… I procrastinate a lot and don’t seem to get anything done.
I like it when folks get together and share opinions. Great blog, continue the good work.
Great entry. I thought the information highly useful. Appreciated the way you clarified everything.
Way cool! Some very valid points! I appreciate you writing this post and also the rest of the site is really good.
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем: сервисные центры по ремонту техники в москве
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
I would like to thank you for the efforts you’ve put in writing this website. I am hoping to view the same high-grade content from you later on as well. In truth, your creative writing abilities has encouraged me to get my own, personal blog now 😉
You made some good points there. I checked on the net to learn more about the issue and found most individuals will go along with your views on this website.
Appreciated the insight in this entry. It’s extremely detailed and packed with helpful information. Great job!
freedom pharmacy: homepage – Trimox
I couldn’t resist commenting. Exceptionally well written!
This article is amazing! Full of valuable insights and very well-written. Thanks for providing this.
You’ve made some decent points there. I looked on the web to learn more about the issue and found most people will go along with your views on this website.
boots pharmacy viagra: online pharmacy clomid – brooks pharmacy store
Spot on with this write-up, I honestly believe this website needs a great deal more attention. I’ll probably be returning to read more, thanks for the advice!
You made some decent points there. I looked on the net to learn more about the issue and found most people will go along with your views on this web site.
Hello! I just would like to offer you a huge thumbs up for the excellent information you’ve got right here on this
post. I will be coming back to your web site for more soon.
Hello! I’m at work browsing your blog from my new iphone 3gs!
Just wanted to say I love reading through your blog and look
forward to all your posts! Keep up the great work!
I blog often and I truly thank you for your information. This article has really peaked my interest. I will take a note of your blog and keep checking for new details about once per week. I subscribed to your RSS feed as well.
An outstanding share! I’ve just forwarded this onto a coworker who has been conducting a little research on this. And he in fact ordered me lunch due to the fact that I discovered it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending the time to discuss this topic here on your web page.
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем: сервисные центры по ремонту техники в москве
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Co-Amoxiclav: pharmaceutical online – medication costs
ремонт цифровых фотоаппаратов в москве
I was able to find good information from your content.
Great information. Lucky me I found your blog by accident (stumbleupon). I’ve saved it for later!
I blog frequently and I genuinely thank you for your information. Your article has truly peaked my interest. I’m going to book mark your site and keep checking for new details about once per week. I subscribed to your RSS feed as well.
Saved as a favorite, I love your site!
rx to go pharmacy league city: erectile dysfunction medications – mexican online pharmacy percocet
Your passion for this topic is contagious.오피
online pharmacy sumatriptan: pharmacies – compound pharmacy
Pretty! This was an extremely wonderful post. Thank you for providing these details.
This page definitely has all the info I needed concerning this subject and didn’t know who to ask.
I’m more than happy to find this great site. I want to to thank you for ones time due to this fantastic read!! I definitely loved every little bit of it and i also have you saved to fav to check out new things in your site.
I quite like reading an article that can make people think. Also, thanks for permitting me to comment.
Having read this I believed it was very informative. I appreciate you taking the time and energy to put this informative article together. I once again find myself personally spending a significant amount of time both reading and posting comments. But so what, it was still worthwhile.
Spot on with this write-up, I truly think this amazing site needs far more attention. I’ll probably be returning to read more, thanks for the advice.
I couldn’t resist commenting. Perfectly written.
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем:ремонт крупногабаритной техники в екатеринбурге
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Профессиональный сервисный центр по ремонту варочных панелей и индукционных плит.
Мы предлагаем: ремонт варочных панелей москва
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
This blog was… how do I say it? Relevant!! Finally I’ve found something which helped me. Cheers.
There’s certainly a great deal to know about this topic. I love all of the points you’ve made.
Pretty! This has been an incredibly wonderful article. Thanks for supplying these details.
Excellent post. I am experiencing some of these issues as well..
We do not harbor which i could not forgive others’ mistakes when this come to.
vavada казино: vavada казино – vavada зеркало
Если вы искали где отремонтировать сломаную технику, обратите внимание – тех профи
vibration analysis
The Value of Oscillation Management Systems in Mechanical Systems
Across production sites, devices along with turning equipment are the support of operations. Nonetheless, a of the most frequent concerns which could hinder the efficiency as well as lifetime exists as resonance. Vibrations may lead to an range of issues, from lowered exactness and productivity leading to greater wear and tear, ultimately resulting in pricey delays and maintenance. This is the point where vibration regulation tools becomes essential.
Why Vibration Control proves Necessary
Oscillation within industrial equipment might bring about multiple adverse effects:
Decreased Operational Performance: Exaggerated oscillation might result in misalignment and imbalance, lowering total productivity of such devices. This might lead to delayed production schedules and higher power consumption.
Heightened Deterioration: Persistent resonance speeds up the erosion of mechanical parts, resulting in increased servicing along with the potential for unanticipated unexpected breakdowns. Such a scenario not only raises maintenance expenses and reduces the longevity of the existing devices.
Protection Concerns: Uncontrolled vibrations can pose significant dangers to the machinery and the machinery and the operators. In, severe cases, this might bring about disastrous system collapse, endangering workers and bringing about widespread harm in the facility.
Accuracy as well as Production Quality Problems: For fields which rely on high precision, including production and aerospace, oscillations might bring about discrepancies with manufacturing, producing defective products and increased waste.
Affordable Options for Vibration Control
Investing in resonance control tools is not just a necessity and a prudent choice for any company that relies on machinery. The offered modern vibration control systems are designed to engineered to reduce vibrations within various machinery or rotating equipment, providing uninterrupted and productive processes.
What differentiates such systems from others remains its reasonable pricing. We understand the significance of cost-effectiveness in today’s competitive market, and for that reason our offerings include high-quality vibration regulation systems at rates that remain budget-friendly.
Opting for our equipment, you are not just securing your equipment as well as boosting its performance but also putting resources in the long-term success of your operations.
Conclusion
Vibration management is an essential component in ensuring the efficiency, security, as well as durability of your equipment. With our economical vibration management tools, it is possible to ensure your processes operate seamlessly, all goods remain top-tier, and your workers remain safe. Don’t let oscillation undermine your operations—put money in the correct apparatus now.
ремонт телевизоров на дому в москве
1win зеркало: 1win зеркало – 1win
http://pin-up.diy/# пин ап вход