mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-09-29 17:08:49 +08:00
Misc fixes across multiple algorithms (#6912)
Source: Snyk code quality Add scikit-fuzzy to requirements Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
This commit is contained in:
co-authored by
pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Dhruv Manilawala
parent
c94e215c8d
commit
04698538d8
@@ -89,13 +89,13 @@ class Graph:
|
||||
# Edge going from node u to v and v to u with weight w
|
||||
# u (w)-> v, v (w) -> u
|
||||
# Check if u already in graph
|
||||
if u in self.adjList.keys():
|
||||
if u in self.adjList:
|
||||
self.adjList[u].append((v, w))
|
||||
else:
|
||||
self.adjList[u] = [(v, w)]
|
||||
|
||||
# Assuming undirected graph
|
||||
if v in self.adjList.keys():
|
||||
if v in self.adjList:
|
||||
self.adjList[v].append((u, w))
|
||||
else:
|
||||
self.adjList[v] = [(u, w)]
|
||||
|
||||
@@ -226,9 +226,6 @@ class DirectedGraph:
|
||||
break
|
||||
else:
|
||||
return True
|
||||
# TODO:The following code is unreachable.
|
||||
anticipating_nodes.add(stack[len_stack_minus_one])
|
||||
len_stack_minus_one -= 1
|
||||
if visited.count(node[1]) < 1:
|
||||
stack.append(node[1])
|
||||
visited.append(node[1])
|
||||
@@ -454,10 +451,6 @@ class Graph:
|
||||
break
|
||||
else:
|
||||
return True
|
||||
# TODO: the following code is unreachable
|
||||
# is this meant to be called in the else ?
|
||||
anticipating_nodes.add(stack[len_stack_minus_one])
|
||||
len_stack_minus_one -= 1
|
||||
if visited.count(node[1]) < 1:
|
||||
stack.append(node[1])
|
||||
visited.append(node[1])
|
||||
|
||||
Reference in New Issue
Block a user