• Verkeerd document? Gratis ruilen
  • Geschreven door studenten die geslaagd zijn
  • Direct beschikbaar na je betaling
  • Online lezen of als PDF
Verkopen
Kies je studieland
Kies je taal
Document preview thumbnail
Voorbeeld 3 van de 30 pagina's
Tentamen (uitwerkingen)

CS 6515 final, CS 6515 Final, CS 6515 Final Review Questions and Correct Answers the Latest Update

Document preview thumbnail
Voorbeeld 3 van de 30 pagina's

Kite Reduction Prove Kite is in np by verifying that - check for the clique - O(n^2) - check for the tail of degree = 2 nodes O(n) - check for that the tail is connected to the clique with Explore (O(n) Reduce Clique to kite by adding a tail of length g to each vertex in graph G O(n^2) Transform back to Clique by removing all vertexs of degree = 2 (prune the tails) If there is no solution to kite then there is no clique in G If there is a solution to kite, removing the tail is then a solution to clique Common Subgraph Prove common subgraph is in NP by - Check that the remaining vertexs is b (O(n) for each graph - Check that Graph G1' and G2' are identical O(nm) Reduce Clique to Common Subgraph by - Creating a copy of G1 , G2 and connecting each vertex to each other vertex in G2 . O(2) - Call Common Subgraph on G1, G2, and the same goal k O(1) take G1 and provide that as the solution to clique if there is a common subgraph. Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess | ExamPreparation | QuizTime | LearningTools | Education | StudentSupport Smart Grades Latest update 1 If there isnt a common subgraph to the clique we created G2 then G1 is not a clique. DFS Input : Graph G(V,E) directed or undirected Output : Prev[z] the parent index of vertex z pre[z] the pre number "" post[z] the post number "" ccum[z] the connected components can be strongly connected if verticies are passed in highest post number after running dfs on a reversed directed graph Runtime: O(N+M) Dijkstra's Input : Graph(V,E) directed or undirected Output : dist[u] the distance from s to u if s can reach u inf otherwise prev[z] the parent index of z non-negative weights O((n+m)logn) - adding weights adds work BFS Input : Graph(V,E) directed or undirected , vertex s C V Output : dist[u] : the distance from s to u if s can reach u prev[z] : the parent index of vertex z O(n+M) - use this for unweighted single source shortest path Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess | ExamPreparation | QuizTime | LearningTools | Education | StudentSupport Smart Grades Latest update 1 Topological Sort Input : Graph G = (V,E), directed acyclic graph (DAG) Output : topo[i] : the vertex number of the i'th vertex in topological order from left to right, source to sink O(n+M) works by running DFS on the DAG and using the post order number to sort the vertices from highest post to lowest post Explore Input: Graph G = (V,E) , directed or undirected, v C V Output : visited[u] is set to true for all nodes u reachable from V - anything else available for DFS O(m) as part of DFS O(n+m) if ran by itself and visited[] needs to be created Subroutine of DFS Use this if you only care about a single source If you are to modify

Voorbeeld van de inhoud

Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess |
ExamPreparation | QuizTime | LearningTools | Education | StudentSupport



CS 6515 final, CS 6515 Final, CS 6515 Final
Review Questions and Correct Answers the
Latest Update
Kite Reduction

✓ Prove Kite is in np by verifying that
✓ - check for the clique - O(n^2)
✓ - check for the tail of degree <= 2 nodes O(n)
✓ - check for that the tail is connected to the clique with Explore (O(n)
✓
✓ Reduce Clique to kite by adding a tail of length g to each vertex in graph G O(n^2)
✓
✓ Transform back to Clique by removing all vertexs of degree <= 2 (prune the tails)
✓
✓ If there is no solution to kite then there is no clique in G
✓ If there is a solution to kite, removing the tail is then a solution to clique



Common Subgraph

✓ Prove common subgraph is in NP by
✓ - Check that the remaining vertexs is > b (O(n) for each graph
✓ - Check that Graph G1' and G2' are identical O(nm)
✓
✓ Reduce Clique to Common Subgraph by
✓ - Creating a copy of G1 , G2 and connecting each vertex to each other vertex in
G2 . O(2)
✓ - Call Common Subgraph on G1, G2, and the same goal k
✓
✓ O(1) take G1 and provide that as the solution to clique if there is a common
subgraph.
✓

Smart Grades Latest update
1

,Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess |
ExamPreparation | QuizTime | LearningTools | Education | StudentSupport

✓ If there isnt a common subgraph to the clique we created G2 then G1 is not a
clique.



DFS

✓ Input : Graph G(V,E) directed or undirected
✓ Output : Prev[z] the parent index of vertex z
✓ pre[z] the pre number ""
✓ post[z] the post number ""
✓ ccum[z] the connected components
✓ can be strongly connected if verticies are passed in highest post number after
running dfs on a reversed directed graph
✓ Runtime: O(N+M)



Dijkstra's

✓ Input : Graph(V,E) directed or undirected
✓ Output :
✓ dist[u] the distance from s to u if s can reach u inf otherwise
✓ prev[z] the parent index of z
✓ non-negative weights
✓ O((n+m)logn) - adding weights adds work



BFS

✓ Input : Graph(V,E) directed or undirected , vertex s C V
✓ Output :
✓ dist[u] : the distance from s to u if s can reach u
✓ prev[z] : the parent index of vertex z
✓ O(n+M)
✓ - use this for unweighted single source shortest path




Smart Grades Latest update
1

, Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess |
ExamPreparation | QuizTime | LearningTools | Education | StudentSupport

Topological Sort

✓ Input : Graph G = (V,E), directed acyclic graph (DAG)
✓ Output :
✓ topo[i] : the vertex number of the i'th vertex in topological order from left to right,
source to sink
✓
✓ O(n+M)
✓ works by running DFS on the DAG and using the post order number to sort the
vertices from highest post to lowest post



Explore

✓ Input: Graph G = (V,E) , directed or undirected, v C V
✓ Output :
✓ visited[u] is set to true for all nodes u reachable from V
✓ - anything else available for DFS
✓
✓ O(m) as part of DFS
✓ O(n+m) if ran by itself and visited[] needs to be created
✓
✓ Subroutine of DFS
✓ Use this if you only care about a single source
✓ If you are to modify a black box algorithm, this would likely be the one



Strongly Connected Components

✓ Input : Graph G = (V,E), directed
✓ Output:
✓ GSCC = (V,E) where GSCC is a meta graph with each SCC in G forming a vertex C
V and each edge between SCCS C E
✓ VSSC will look like 1,2,3,4 which are ccums
✓ ESSC will look like (1,2) (2,3) (3,4) which are edges between VSSC

Smart Grades Latest update
1

Documentinformatie

Geüpload op
21 oktober 2024
Aantal pagina's
30
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden
$13.99

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Passit
3.5
(23)
Verkocht
135
Volgers
6
Items
14453
Laatst verkocht
1 week geleden



Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen