CS502 Quiz 2 Solution and Discussion


  • Cyberian's Gold

    What general property of the list indicates that the graph has an isolated vertex?

    • There is Null pointer at the end of list.

    • The Isolated vertex is not handled in list.

    • Only one value is entered in the list.

    • There is at least one null list.



  • @moaaz okey… But it’s not understood coz It’s not my subject



  • @moaaz ok.


  • Cyberian's Gold

    A graph is not connected if every vertex can reach every other vertex. CS502

    2c02c5dd-0811-49fc-9811-b18004bab115-image.png
    A graph is said to be acyclic if it contains no cycles. A graph is connected if every vertex can reach every other vertex. A directed graph that is acyclic is called a directed acyclic graph (DAG).


  • Cyberian's Gold

    In strong components algorithm, first of all DFS is run for computing finish times of vertices. CS502

    8b530b5c-5a5e-4f87-8010-bccb5d28f22a-image.png

    This is presented in Figure 8.37. Recall that the component DAG consists of super vertices.

    5cf9148a-bd09-4696-87ef-b6de10a1ed71-image.png


  • Cyberian's Gold

    In strong components algorithm, first of all DFS is run for computing finish times of vertices. CS502

    • [d[u], f[u]]⊆[d[v], f[v]]
    • [d[u], f[u]]⊇[d[v], f[v]]
    • unrelated Page No.129
    • Disjoint

    eba9d7b3-7308-4775-9b01-2a62ce935ec1-image.png

    The ancestor and descendent relation can be nicely inferred by the parenthesis lemma. u is a descendent of v if and only if [d[u], f[u]]⊆[d[v], f[v]]. u is a ancestor of v if and only if[d[u], f[u]]⊇[d[v], f[v]]. u is unrelated to v if and only if[d[u], f[u]]and[d[v], f[v]]are disjoint. The is shown in Figure 8.26. The width of the rectangle associated with a vertex is equal to the time the vertex was discovered till the time the vertex was completely processed (colored black). Imagine an opening parenthesis ‘(’ at the start of the rectangle and and closing parenthesis ‘)’ at the end of the rectangle. The rectangle (parentheses) for vertex ‘b’ is completely enclosed by the rectangle for ‘a’. Rectangle for ‘c’ is completely enclosed by vertex ‘b’ rectangle.

    1ef3265c-c43b-4f86-b0e3-de47babbd3ff-image.png


  • Cyberian's Gold

    For traversing graphs, Breadth-first search can be visualized as a wave front propagating inwards towards root (or source) node. CS502

    7bca315f-cfae-45fc-ad80-f75703426b00-image.png

    Breadth-first Search:
    Here is a more efficient algorithm called the breadth-first search (BFS) Start with s and visit its adjacent nodes. Label them with distance 1. Now consider the neighbors of neighbors of s. These would be at distance 2. Now consider the neighbors of neighbors of neighbors of s. These would be at distance 3. Repeat this until no more unvisited neighbors left to visit. The algorithm can be visualized as a wave front propagating outwards from s visiting the vertices in bands at ever increasing distances from s.


  • Cyberian's Gold

    Digraphs are not used in communication and transportation networks. CS502

    b94832fd-0844-458d-bac8-da04d6a6e9a2-image.png

    Strong Components:
    We consider an important connectivity problem with digraphs. When diagraphs are used in communication and transportation networks, people want to know that their networks are complete.


  • Cyberian's Gold

    You have an adjacency list for G, what is the time complexity to compute Graph transpose G^T.? CS502 ?

    04ac8d73-a0fc-4599-b55f-0783827ca2e1-image.png

    We will discuss the algorithm without proof. Define GT to be the digraph with the same vertex set at G but in which all edges have been reversed in direction. This is shown in Figure 8.38. Given an adjacency list for G, it is possible to compute G Tin Θ (V+E) time.


  • Cyberian's Gold

    In computing the strongly connected components of a digraph, vertices of the digraph are not partitioned into subsets. CS502

    006639aa-e9db-4d84-aa28-8d45a0077238-image.png

    We partition the vertices of the digraph into subsets such that the induced sub graph of each subset is strongly connected.


  • Cyberian's Gold

    There are no ________ edges in undirected graph. CS502

    85948814-5601-47e3-8c1b-e07a81295587-image.png
    For undirected graphs, there is no distinction between forward and back edges.


  • Cyberian's Gold

    We say that two vertices u and v are mutually not reachable if u can reach v and vice versa. CS502

    8f51310c-d8e0-4973-b325-c6680ff127cb-image.png

    A digraph is strongly connected if for every pair of vertices u, v∈V,u can reach v and vice versa.



Quiz 100% Result Quiz 100% Result
| |