• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 30 pages
Exam (elaborations)

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

Document preview thumbnail
Preview 3 out of 30 pages

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

Content preview

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

Document information

Uploaded on
October 21, 2024
Number of pages
30
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$13.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Passit
3.5
(23)
Sold
135
Followers
6
Items
14453
Last sold
1 week ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions