mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-07 10:50:36 +00:00
Auto urgent commit.
This commit is contained in:
BIN
graphes/DS_possible/elouan_fare.tar
Normal file
BIN
graphes/DS_possible/elouan_fare.tar
Normal file
Binary file not shown.
27
graphes/DS_possible/main.py
Normal file
27
graphes/DS_possible/main.py
Normal file
@@ -0,0 +1,27 @@
|
||||
graphe = {
|
||||
"node1": ["node2","node4"],
|
||||
"node2": ["node2","node3","node6"],
|
||||
"node3": ["node5"],
|
||||
"node5": ["node5","node6"],
|
||||
"node4": ["node1","node5"],
|
||||
"node6": []
|
||||
}
|
||||
print(graphe["node1"])
|
||||
def bfs(graphe, start_node):
|
||||
queue = [start_node]
|
||||
|
||||
visited = set()
|
||||
while queue:
|
||||
node = queue.pop(0)
|
||||
if node not in visited:
|
||||
print(node)
|
||||
visited.add(node)
|
||||
for neighbor in graphe[node]:
|
||||
if neighbor not in visited:
|
||||
queue.append(neighbor)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bfs(graphe,"node1")
|
||||
BIN
graphes/DS_possible/v
Normal file
BIN
graphes/DS_possible/v
Normal file
Binary file not shown.
Reference in New Issue
Block a user