精选北大PKU 慕课 EDX 数据结构与算法 第八章图 quiz答案与解析.docx
《精选北大PKU 慕课 EDX 数据结构与算法 第八章图 quiz答案与解析.docx》由会员分享,可在线阅读,更多相关《精选北大PKU 慕课 EDX 数据结构与算法 第八章图 quiz答案与解析.docx(8页珍藏版)》请在冰豆网上搜索。
![精选北大PKU 慕课 EDX 数据结构与算法 第八章图 quiz答案与解析.docx](https://file1.bdocx.com/fileroot1/2022-10/25/b720b62e-008b-411e-a841-d550b62012f5/b720b62e-008b-411e-a841-d550b62012f51.gif)
精选北大PKU慕课EDX数据结构与算法第八章图quiz答案与解析
第八章图
Problem1
(1/1分)
下图中的强连通分量的个数为多少个?
Howmanystronglyconnectedgraphsintheundergraph?
3-正确
3
3
Explanation
有向图强连通的极大子图称为该有向图的强连通分支或者强连通分量。
分别为最左边1个点组成的极大子图,中间4个点组成的极大子图和最右边1个点组成的极大子图。
分别为最左边1个点,中间4个点和最右边1个点。
Maximalstronglyconnectedsubgraphsofadirectedgrapharecalledstronglyconnectedcomponentsofthisdirectedgraph.Theyarethesubgraphconsistoftheleft-mostvertex,thesubgraphconsistof4verticesinthemiddle,,andthesubgraphconsistoftheright-mostvertexrespectively.
Problem2
(1/1分)
下面关于图的说法正确的有(多选)
Therightstatementsofgraphsinthefollowingare:
(Therearemorethanonecorrectanswers)
窗体顶端
对于无向图,所有结点的度数加起来一定是偶数。
Asforundirectedgraphs,thesumofdegreesofallverticesisdefinitelyevennumber.,将有向图的一个强连通分量中的边全部反向仍然是强连通分量。
Reversionalltheedgesofastronglyconnectedcomponentofadirectedgraph,thenthesubgraphisstillastronglyconnectedcomponent.,-正确
对于无向图,所有结点的度数加起来一定是偶数。
Asforundirectedgraphs,thesumofdegreesofallverticesisdefinitelyevennumber.将有向图的一个强连通分量中的边全部反向仍然是强连通分量。
Reversionalltheedgesofastronglyconnectedcomponentofadirectedgraph,thenthesubgraphisstillastronglyconnectedcomponent.对于有向图,每个结点的出度必须要等于入度。
Asfordirectedgraph,eachvertices’out-degreeisequaltoitsin-degree.对于一个连通图,一定存在一种给边添加方向的方案使得这个图变成强连通图。
Foraconnectedgraph,theremustbeawayofdirectingalltheedgesoftheoriginalgraphtomakethegraphstronglyconnectedgraph.
窗体底端
Explanation
结点度数是边数的2倍,故一定为偶数。
Thesumofdegreesofverticesisequaltotheamountofedgetimes2,soitmustbeevennumber.
原来强连通分量中的点必须能够互达,边全部反向后,仍然能够互达。
而原来强连通分量外的点和强连通分量内的点之间的边没有变化,以前不能互达现在还是不能,这样保证了仍然是极大的强连通子图。
Intheoriginalstronglyconnectedcomponent,everypairofverticesinthesubgraphisconnectedbyapath.Afterreversion,thispropertydoesn'tchange.Andtheconnectivityoftheverticesoutsideofthesubgraphandverticesinthesubgraphdon'tchangetoo.Sowecanguaranteeitstillbethemaximalstronglyconnectedsubgraph.
所有结点的出度之和等于入度之和,但是每个结点并没有出度和入度相等的性质。
Thesumofin-degreesofallnodesisequaltothesumofout-degreesofallnodes.Butforeachnode,itdoesn'twork.
给两个结点新增一条边相连,能够形成一个连通图,但是不管怎么给边定向都不能使其成为强连通图。
Addanedgeoftwovertex,thenwecangetaconnectedgraph.Butwecan'tmakeit
stronglyconnectedgraphhoweverwedirecttheedges.
Problem3
(1/1分)
当各边上的权值满足什么要求时,宽度优先搜索算法可用来解决单源最短路径问题?
(单选)
Whatrequirementdotheweightofedgesshouldsatisfiedtomakewidth-firstsearchalgorithmcansolvesinglesourceshortestpathproblem?
(Thereisonlyonecorrectanswer)
窗体顶端
不一定相等Nolimitation.均互不相等Eachedgeisnotequaltoeachother.均相等Equal均相等Equal-正确
窗体底端
Explanation
均相等宽度优先搜索算法的搜索状态树是一层一层的扩展结点的,而当边权均相等时,步数越少距离越短,所以可以直接用宽度优先搜索算法解决。
EqualWidth-firstsearchalgorithm'ssearch-state-treeexpandslayerbylayer.Whentheweightofedgesisequaltoeachother,lesserstepcorrespondstoshorterdistance,sowecanusewidth-firstsearchalgorithmtosolveproblem.
均互不相等宽度优先搜索算法的搜索状态树是一层一层的扩展结点的,而当边权均相等时,步数越少距离越短,所以可以直接用宽度优先搜索算法解决。
Eachedgeisnotequaltoeachother.Width-firstsearchalgorithm'ssearch-state-treeexpandsverticeslayerbylayer.Whentheweightofedgesisequaltoeachother,lesserstepcorrespondstoshorterdistance,sowecanusewidth-firstsearchalgorithmtosolveproblem.
不一定相等宽度优先搜索算法的搜索状态树是一层一层的扩展结点的,而当边权均相等时,步数越少距离越短,所以可以直接用宽度优先搜索算法解决。
Nolimitation.Width-firstsearchalgorithm'ssearch-state-treeexpandsverticeslayerbylayer.Whentheweightofedgesisequaltoeachother,lesserstepcorrespondstoshorterdistance,sowecanusewidth-firstsearchalgorithmtosolveproblem.
Problem4
(1/1分)
下列关于最短路算法的说法正确的有:
(多选)
Therightstatementsofthefollowingare:
(Therearemorethanonecorrectanswers)
窗体顶端
当图中不存在负权回路但是存在负权边时,Dijkstra算法不一定能求出源点到所有点的最短路。
Whenthegraphdoesn'tcontaincircuitofnegativeweight,butcontainstheedgeofnegativeweight.Dijkstraalgorithmcan'tguaranteethecorrectnessofthealgorithm.,当图中不存在负权边时,Dijkstra算法能求出每对顶点间最短路径。
Whenthegraphdoesn'tcontainedgeofnegativeweight,Dijkstraalgorithmcancalculatetheshortestpathofeachpairofvertices.,-正确
当图中不存在负权回路但是存在负权边时,Dijkstra算法不一定能求出源点到所有点的最短路。
Whenthegraphdoesn'tcontaincircuitofnegativeweight,butcontainstheedgeofnegativeweight.Dijkstraalgorithmcan'tguaranteethecorrectnessofthealgorithm.当图中不存在负权边时,Dijkstra算法能求出每对顶点间最短路径。
Whenthegraphdoesn'tcontainedgeofnegativeweight,Dijkstraalgorithmcancalculatetheshortestpathofeachpairofvertices.当图中存在负权回路时,Dijkstra算法也一定能求出源点到所有点的最短路。
Whenthegraphcontainsthecircuitofnegativeweight,Dijkstraalgorithmcancertainlycalculatetheshortestpathformthesinglesourcetoallthevertices.Dijkstra算法不能用于每对顶点间最短路计算。
Dijkstraalgorithmcan'tbeappliedtocalculatetheshortestpathofea