#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1037
Task: Write a Python function that implements BFS and DFS on a simple adjacency list graph
Generated: 2026-02-12T17:54:01.213564
"""

from collections import deque

def bfs(graph, start):
    visited = []
    queue = deque([start])
    visited.append(start)
    
    while queue:
        vertex = queue.popleft()
        for neighbor in graph[vertex]:
            if neighbor not in visited:
                visited.append(neighbor)
                queue.append(neighbor)
    return visited

def dfs(graph, start):
    visited = []
    stack = [start]
    
    while stack:
        vertex = stack.pop()
        if vertex not in visited:
            visited.append(vertex)
            for neighbor in reversed(graph[vertex]):
                if neighbor not in visited:
                    stack.append(neighbor)
    return visited

if __name__ == '__main__':
    # Example graph represented as an adjacency list
    graph = {
        'A': ['B', 'C'],
        'B': ['A', 'D', 'E'],
        'C': ['A', 'F'],
        'D': ['B'],
        'E': ['B', 'F'],
        'F': ['C', 'E']
    }
    
    bfs_result = bfs(graph, 'A')
    dfs_result = dfs(graph, 'A')
    
    print("BFS Traversal:")
    print(bfs_result)
    print("\nDFS Traversal:")
    print(dfs_result)