Podcast
Questions and Answers
Hvaða fullyrðing er sönn varðandi tré stystu vega og léttasta spanntré, jafnvel þótt bæði séu spanntré?
Hvaða fullyrðing er sönn varðandi tré stystu vega og léttasta spanntré, jafnvel þótt bæði séu spanntré?
- Tré stystu vega eru óstefnd og án rótar, á meðan léttustu spanntré eru með rót og stefnu.
- Tré stystu vega eru náttúrulegri fyrir óstefnd net, en léttustu spanntré fyrir stefnd net.
- Tré stystu vega hafa rót og stefnu, á meðan léttustu spanntré eru óstefnd og án rótar. (correct)
- Báðar aðferðirnar leiða alltaf til sömu niðurstöðu óháð því hvort netið er stefnt eða óstefnt.
Í hvaða tilfelli er tæknilega réttara að tala um stystu göngur frekar en stystu vegi í samhengi við reiknirit?
Í hvaða tilfelli er tæknilega réttara að tala um stystu göngur frekar en stystu vegi í samhengi við reiknirit?
- Þegar neikvæðar rásir eru til staðar. (correct)
- Þegar unnið er með óstefnd net.
- Þegar allar vogtölur á leggjum eru jákvæðar.
- Þegar engar neikvæðar rásir eru til staðar.
Hvaða fullyrðing lýsir best muninum á tré stystu vega og léttasta spanntrés þegar vogtölur á leggjum eru allar ólíkar?
Hvaða fullyrðing lýsir best muninum á tré stystu vega og léttasta spanntrés þegar vogtölur á leggjum eru allar ólíkar?
- Það er aðeins eitt léttasta spanntré, en sérhver upphafshnútur gefur mismunandi tré stystu vega. (correct)
- Það er aðeins eitt tré stystu vega og aðeins eitt léttasta spanntré.
- Það er aðeins eitt tré stystu vega, en sérhver upphafshnútur gefur mismunandi léttasta spanntré.
- Sérhver upphafshnútur gefur sama tré stystu vega og sama léttasta spanntré.
Í hvaða tilvikum gæti leyfi fyrir neikvæðum vogtölum á leggjum verið eðlilegt í stystu vega vandamálum?
Í hvaða tilvikum gæti leyfi fyrir neikvæðum vogtölum á leggjum verið eðlilegt í stystu vega vandamálum?
Hvaða vandamál geta neikvæðar rásir valdið í stystu vega vandamáli?
Hvaða vandamál geta neikvæðar rásir valdið í stystu vega vandamáli?
Hvaða fullyrðing er rétt varðandi reiknirit til að finna stysta einfalda veginn þegar neikvæðar rásir eru til staðar?
Hvaða fullyrðing er rétt varðandi reiknirit til að finna stysta einfalda veginn þegar neikvæðar rásir eru til staðar?
Af hverju skoðum við eingöngu stefnd net þegar kemur að neikvæðum vogtölum?
Af hverju skoðum við eingöngu stefnd net þegar kemur að neikvæðum vogtölum?
Hvað er sameiginlegt með reikniritunum sem finna stysta veg?
Hvað er sameiginlegt með reikniritunum sem finna stysta veg?
Hvaða tvo hluti geymir hver hnútur v
í Ford reikniritinu sem lýsa tilraunavegi frá upphafshnútnum s
?
Hvaða tvo hluti geymir hver hnútur v
í Ford reikniritinu sem lýsa tilraunavegi frá upphafshnútnum s
?
Hvað er átt við með 'spenntum legg' í samhengi við reiknirit til að finna stysta veg?
Hvað er átt við með 'spenntum legg' í samhengi við reiknirit til að finna stysta veg?
Hvaða fullyrðing er rétt um Ford-SSSP reikniritið þegar það lýkur keyrslu?
Hvaða fullyrðing er rétt um Ford-SSSP reikniritið þegar það lýkur keyrslu?
Hvaða fullyrðing er rétt um keyrslu Ford-reikniritsins?
Hvaða fullyrðing er rétt um keyrslu Ford-reikniritsins?
Hvað gerist ef neikvæð rás er aðgengileg frá upphafshnúti s
í Ford reikniritinu?
Hvað gerist ef neikvæð rás er aðgengileg frá upphafshnúti s
í Ford reikniritinu?
Hvaða tvö atriði þarf að huga að við útfærslu á Ford-reikniritinu?
Hvaða tvö atriði þarf að huga að við útfærslu á Ford-reikniritinu?
Hver er grundvallarmunurinn á breiddarleit og dýptarleit?
Hver er grundvallarmunurinn á breiddarleit og dýptarleit?
Hvað gerir breiddarleit þegar spenntur leggur u → v
finnst?
Hvað gerir breiddarleit þegar spenntur leggur u → v
finnst?
Hvaða fullyrðing er rétt varðandi notkun tákns í breiddarleit?
Hvaða fullyrðing er rétt varðandi notkun tákns í breiddarleit?
Hvaða fullyrðing er alltaf sönn við lok i-ta fasans í breiddarleit með tákni?
Hvaða fullyrðing er alltaf sönn við lok i-ta fasans í breiddarleit með tákni?
Hvaða tímaflækju hefur breiddarleit?
Hvaða tímaflækju hefur breiddarleit?
Hvaða fullyrðing er rétt varðandi fjarlægð hnútar v
í breiddarleit?
Hvaða fullyrðing er rétt varðandi fjarlægð hnútar v
í breiddarleit?
Við hvaða skilyrði getum við skipt út skilyrðinu dist(v) > dist(u) + 1
út fyrir skilyrðið dist(v) = ∞
í breiddarleit?
Við hvaða skilyrði getum við skipt út skilyrðinu dist(v) > dist(u) + 1
út fyrir skilyrðið dist(v) = ∞
í breiddarleit?
Hvað er markmiðið með því að finna stysta veg milli tveggja borga?
Hvað er markmiðið með því að finna stysta veg milli tveggja borga?
Af hverju er mikilvægt að reikna út stysta mögulega veginn?
Af hverju er mikilvægt að reikna út stysta mögulega veginn?
Í hvaða tilfelli er Single Source Shortest Path (SSSP) vandamálið gagnlegt?
Í hvaða tilfelli er Single Source Shortest Path (SSSP) vandamálið gagnlegt?
Hvað táknar hvert hlutfall stysta vegar í stærra samhengi?
Hvað táknar hvert hlutfall stysta vegar í stærra samhengi?
Hvers vegna er mikilvægt að huga að neikvæðum vogtölum í leggjum?
Hvers vegna er mikilvægt að huga að neikvæðum vogtölum í leggjum?
Hvaða vandkvæði geta neikvæðar vogtölur valdið?
Hvaða vandkvæði geta neikvæðar vogtölur valdið?
Hvers vegna er breiddarleit notuð í óvegnum netum?
Hvers vegna er breiddarleit notuð í óvegnum netum?
Í upphafi reikniritsins er hnúturinn s
tekinn fyrir og settur í biðröð, hvernig hefur breiddarleitin áhrif á þetta?
Í upphafi reikniritsins er hnúturinn s
tekinn fyrir og settur í biðröð, hvernig hefur breiddarleitin áhrif á þetta?
Hvað gerist þegar breiddarleitin finnur spenntan legg?
Hvað gerist þegar breiddarleitin finnur spenntan legg?
Flashcards
Shortest Path Problem
Shortest Path Problem
Find the shortest path P from a start node s to an end node t in a weighted, directed graph G. The edge weights are w.
Single Source Shortest Path (SSSP)
Single Source Shortest Path (SSSP)
A more general problem than finding the shortest path between two specific nodes. It finds the shortest paths from a source node to all other nodes in the network.
Shortest Path Tree
Shortest Path Tree
If the shortest paths from a source node are unique, they form a tree structure.
Shortest Path Tree with Multiple Optimal Paths
Shortest Path Tree with Multiple Optimal Paths
Signup and view all the flashcards
Shortest Path Trees vs. Minimum spanning trees
Shortest Path Trees vs. Minimum spanning trees
Signup and view all the flashcards
Positive Edge Weights
Positive Edge Weights
Signup and view all the flashcards
Negative Edge Weights
Negative Edge Weights
Signup and view all the flashcards
Negative Cycles
Negative Cycles
Signup and view all the flashcards
Dijkstra Algorithm
Dijkstra Algorithm
Signup and view all the flashcards
Bellman-Ford & Moore Algorithms
Bellman-Ford & Moore Algorithms
Signup and view all the flashcards
Ford's SSSP Algorithm
Ford's SSSP Algorithm
Signup and view all the flashcards
SSSP Node Values
SSSP Node Values
Signup and view all the flashcards
Tense Edges
Tense Edges
Signup and view all the flashcards
Relaxing an Edge
Relaxing an Edge
Signup and view all the flashcards
Ford SSSP Process
Ford SSSP Process
Signup and view all the flashcards
Breadth-First Search (BFS)
Breadth-First Search (BFS)
Signup and view all the flashcards
BFS Queue
BFS Queue
Signup and view all the flashcards
BFS Edge Processing
BFS Edge Processing
Signup and view all the flashcards
BFS Phases
BFS Phases
Signup and view all the flashcards
Study Notes
- Study notes generated from the provided text.
Overview
- Focus is on shortest paths in graphs.
Shortest Paths
- Given a weighted graph G = (V, E, w) with two specific nodes, the goal is to find the shortest path P from node s to node t.
- The total weight of path P is minimized.
- Hnodes are cities, edges are roads, and weights are travel times.
General Problem: Single Source Shortest Path (SSSP)
- Many algorithms finding the shortest path between two nodes solve a more general problem.
- It finds the shortest path from the starting node s to all other nodes in the network.
- Solution usually involves constructing a tree of shortest paths rooted at s.
Properties of Shortest Paths
- If the shortest paths are unique, they form a tree.
- Every subpath of a shortest path is also a shortest path.
- Even with multiple shortest paths, a single path to each node can be chosen to form a tree
Shortest Path Tree vs. Minimum Spanning Tree
- Two distinct types of trees.
- Shortest path trees are rooted and directed.
- Minimum spanning trees are undirected and unrooted.
- Shortest path trees are more suitable for directed graphs
- Minimum spanning trees are better for undirected graphs.
- Unique edge weights ensure a single minimum spanning tree, but multiple shortest path trees may exist depending on the starting node.
- Shortest path trees may use different edges than the minimum spanning tree.
Negative Weights
- Shortest path problems typically assume positive edge weights.
- However, negative weights can be useful.
Negative Cycles
- Can cause issues in shortest path problems, potentially leading to undefined shortest paths.
- The shortest path from s to t exists if there's a path and no path from s to t intersects a negative cycle.
- If a path touches a negative cycle, a shorter path exists by traversing the cycle one more time.
- These cases technically involve finding shortest walks, not shortest paths.
- If a shortest walk exists it must be a simple path.
- Finding the simple shortest path when negative cycles exist is NP-hard
Negative Weight Notes and Undirected Graphs
- The focus may be on directed graphs when negative weights are involved.
- Some algorithms can work on undirected graphs with modifications if negative weights are not allowed.
Handling Negative Weights
- Handling negative weights in undirected graphs is more complex
- Replacing an undirected edge with negative weight creates a negative cycle and requires some additional work.
- Hedges that contain negative weights may no longer be the shortest path
Non-negative Edges
- The set of all the shortest path cannot create a tree
Undirected and Negative Weights
- Course work does not cover undirected nets with negative weights
- The simplest way to find the shortest path in undirected nets with negative weight, is to do a transformation.
- The transformation has a time complexity of O(VE + V * V log V)
- The process builds on transfers of maximum weighted matching
Single Source Shortest Path Algorithms
- (SSSP) algorithms described
- Many SSSP algorithms can be seen as specific versions of one general algorithm.
- The general algorithm was first suggested my Lester Ford in 1956
- The algorithm was published independently by George Dantzig in 1957 and George Minty in 1958
SSSP algorithm node values
- Each node v stores two values related to tentative path s ~ v
- dist(v) is the length of the tentative path s ~ v, or infinite if no such path exists
- pred(v) is the parent of v on the path s ~ v, or Null if no parent exists
Initialize SSSP algorithm
- Node distances and parents are initialized as shown
Spanning Edges are relaxed
- An edge u -> v is relaxed is dist(u) + w(u -> v) < dist(v)
Tentative path assumptions
- If u -> v is relaxed then the tentative path s ~ v is wrong, because s ~ u -> v is shorter
Repairing tentative paths
- repair or lower the cost, by relaxing the nodes
- An edge u -> v that is tense is relaxed until there are no more tense edges left
Correctness of Ford SSSP Algorithm, it can be shown that:
- The parent pointers define a correct shortest-path tree
- Each value dist(v) is the true distance of its shortest path from s to v.
- If s can't reach v, dist(v) = infinity.
- If a negative cycle can be reached from s, the algorithm never stops.
Ford Algorithm Proofs
- The Ford algorithm is proved through the affirmational statements that hold true:
- For any time in the algorithms iteration, dist(v) is either infinite, or the length from s to v
- If the net has no negative circles, the dist(v) is either infinite or the length of the line from s to v
- If there are not negative circles, then dist(v) is in relation to length between s and v
- All nodes in G do not have spenntur then dist(v)
Ford Algorithm Implementations
- The implementations can alter based on different types of nets
Breadth-First Search (BFS)
- A type of Ford Algorithm
- Used for unweighted nets
Breadth-First Search
- Uses a queue (FIFO) to hold nodes.
- Initially, the queue contains only the starting node s.
- Each vertex u is taken from the queue.
- Slacks the line u -> v, and v is added to the queue
- Once the queue is empty, returns to start
Breadth-First Search Phase Tracking
- Make it easier to follow processes by adding phases.
- Phases can be tracked in the queue.
- The algorithm adds a phase to the queue and then goes through the nodes.
- Phases begin and return during the marking of the queue.
- The first phase starts by queuing the starting node
- Phases are ignored, only really used to mark the queue.
- Gives a more accurate timeline and process flow.
Important Facts about BFS with distance (v)
- BFS gives the distances in a non-decreasing order; the distances never increase.
- The line dist(v) = dist(u) + 1 runs only once during each node visit.
- pred(v) can be the distance in a path dist(v) and can then get checked.
- The line dist(v) > dist(u) comes from the distances given from dist(u) + 1
When BFS Ends
- BFS ends when path dist(v) is the smallest G can make it from vertex s -> v.
- Distance (v) and the distance it creates helps identify the smallest distance it has.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.