Page 1 of 1

please help thanks Problem 1. [Category: Coding: Find if path exists in graph] Given an undirectional graph with n nodes

Posted: Sat Nov 27, 2021 2:35 pm
by answerhappygod
please help thanks
Problem 1. [Category: Coding: Find if path exists in graph]
Given an undirectional graph with n nodes, where each node is
labeled from 0 to n−1 (inclusive). The edges in the graph is
represented by array edges where each element edges = [ui, vi]
denotes an undirectional edge between node ui and node vi. Every
node pair is connected by at most one edge, and no vertex has an
edge to itself. Your task: is to determine if there is a valid path
exists from node s to node t. Given edges and the integers
n, s, and t, return true if there is a valid path from s to t,
or false otherwise.
Example:

Please Help Thanks Problem 1 Category Coding Find If Path Exists In Graph Given An Undirectional Graph With N Nodes 1
Please Help Thanks Problem 1 Category Coding Find If Path Exists In Graph Given An Undirectional Graph With N Nodes 1 (12.4 KiB) Viewed 68 times
Input: n = 6, edges = [[0, 1], [0, 2], [3, 5], [5, 4], [4, 3]],
s = 0, t = 5 Output: false Explanation: There is no path from node
0 to node 5.
Input: n = 6, edges = [[0, 1], [0, 2], [3, 5], [5, 4], [4, 3]],
s = 0, t = 2
[10 points]
Output: true Explanation: There is one path from node 0 to node
2.
Problem 2. [Category: Simulating and coding: Topological
order]
Please Help Thanks Problem 1 Category Coding Find If Path Exists In Graph Given An Undirectional Graph With N Nodes 2
Please Help Thanks Problem 1 Category Coding Find If Path Exists In Graph Given An Undirectional Graph With N Nodes 2 (9.6 KiB) Viewed 68 times
2 5

6 с a f d e