CodingChallenge / csv_generate.py
csv_generate.py
Raw
import csv

def create_adjacency_csv(file_path):
    data = [
        ("Hamburg", "A", "B"),
        ("Hamburg", "A", "H"),
        ("Hamburg", "B", "H"),
        ("Berlin", "A", "B"),
        ("Berlin", "A", "H"),
        ("Berlin", "H", "I"),
        ("Koeln", "A", "B"),
        ("Koeln", "A", "C"),
        ("Koeln", "A", "H"),
        ("Koeln", "B", "C"),
        ("Koeln", "B", "H"),
        ("Koeln", "B", "I"),
        ("Koeln", "C", "H"),
        ("Koeln", "C", "I"),
        ("Koeln", "D", "E"),
        ("Koeln", "D", "I"),
        ("Koeln", "D", "J"),
        ("Koeln", "E", "F"),
        ("Koeln", "E", "I"),
        ("Koeln", "F", "G"),
        ("Koeln", "F", "I"),
        ("Koeln", "G", "I"),
        ("Koeln", "H", "I")
    ]

    with open(file_path, 'w', newline='') as file:
        writer = csv.writer(file)
        writer.writerow(["City", "Point1", "Point2"])
        for row in data:
            writer.writerow(row)

# Example usage:
create_adjacency_csv('adjacency_data.csv')