<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohapatra Lohit on Medium]]></title>
        <description><![CDATA[Stories by Mohapatra Lohit on Medium]]></description>
        <link>https://medium.com/@mohapatra.lohit?source=rss-cc39f1d41ed7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Mohapatra Lohit on Medium</title>
            <link>https://medium.com/@mohapatra.lohit?source=rss-cc39f1d41ed7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:55:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohapatra.lohit/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Dataset Formatting Matters for Fine-Tuning and Evaluating LLMs]]></title>
            <link>https://medium.com/@mohapatra.lohit/why-dataset-formatting-matters-for-fine-tuning-and-evaluating-llms-954588fe34a9?source=rss-cc39f1d41ed7------2</link>
            <guid isPermaLink="false">https://medium.com/p/954588fe34a9</guid>
            <category><![CDATA[fine-tuning-llm]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Mohapatra Lohit]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 04:35:27 GMT</pubDate>
            <atom:updated>2025-07-22T04:47:03.809Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Tips for prepping your data so large language models actually learn what you want them to.</em></p><p>LLMs are showing up everywhere — from customer support bots to internal tools, content generation, coding and writing assistants. If you’re working on fine-tuning a model or evaluating its performance on your own data, one thing matters more than you’d expect: <strong>how your dataset is formatted</strong>.</p><p>You can’t just hand over a csv or a random JSON file. Each platform — OpenAI, Anthropic, Hugging Face, and others — has their own format rules. If you don’t follow them, your training job will likely fail, or worse, succeed and teach the model the wrong thing.</p><p>Here’s a practical guide to get it right:</p><h3>Why Formatting Really Matters</h3><p>Fine-tuning a language model isn’t just about feeding it input and output pairs. These models look for patterns like who’s speaking (user or assistant), what tone to use, and how to respond.</p><p>That’s why:</p><ul><li>You need to clearly show who’s saying what (system/user/assistant).</li><li>The file type (like .jsonl) needs to match the tool’s expected format.</li><li>The structure has to align with how the model was trained originally.</li></ul><p>If your data is off even a little, you could get bad predictions — or no predictions at all.</p><h3>Common Dataset Formats by Provider</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*wgssFJ15gF1oTWQzjG1dww.png" /></figure><h3>Converting Your Data to Match Their Format</h3><p>Here’s a sample record we’ll use:</p><pre>record = {<br>    &quot;input_text&quot;: &quot;What is machine learning?&quot;,<br>    &quot;output_text&quot;: &quot;Machine learning is a subset of artificial intelligence.&quot;,<br>    &quot;system_prompt&quot;: &quot;You are a helpful assistant.&quot;<br>}</pre><h3>1. OpenAI Format</h3><pre>import json<br><br>def convert_to_openai(record):<br>    messages = []<br>    if record.get(&quot;system_prompt&quot;):<br>        messages.append({&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: record[&quot;system_prompt&quot;]})<br>    messages.append({&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: record[&quot;input_text&quot;]})<br>    messages.append({&quot;role&quot;: &quot;assistant&quot;, &quot;content&quot;: record[&quot;output_text&quot;]})<br>    return {&quot;messages&quot;: messages}<br><br>with open(&quot;openai_finetune.jsonl&quot;, &quot;w&quot;) as f:<br>    f.write(json.dumps(convert_to_openai(record)) + &quot;\n&quot;)</pre><h3>2. Anthropic Format</h3><pre>def convert_to_anthropic(record):<br>    data = {<br>        &quot;input&quot;: record[&quot;input_text&quot;],<br>        &quot;output&quot;: record[&quot;output_text&quot;]<br>    }<br>    if record.get(&quot;system_prompt&quot;):<br>        data[&quot;system&quot;] = record[&quot;system_prompt&quot;]<br>    return data<br><br>with open(&quot;anthropic_finetune.jsonl&quot;, &quot;w&quot;) as f:<br>    f.write(json.dumps(convert_to_anthropic(record)) + &quot;\n&quot;)</pre><h3>3. Hugging Face Format</h3><pre>def convert_to_hf(record):<br>    text = &quot;&quot;<br>    if record.get(&quot;system_prompt&quot;):<br>        text += f&quot;System: {record[&#39;system_prompt&#39;]}\n&quot;<br>    text += f&quot;Human: {record[&#39;input_text&#39;]}\nAssistant: {record[&#39;output_text&#39;]}&quot;<br>    return {&quot;text&quot;: text}<br><br>with open(&quot;hf_sft_data.jsonl&quot;, &quot;w&quot;) as f:<br>    f.write(json.dumps(convert_to_hf(record)) + &quot;\n&quot;)</pre><h3>4. Custom CSV Format</h3><pre>import csv<br><br>def convert_to_csv(records, file_path):<br>    with open(file_path, mode=&#39;w&#39;, newline=&#39;&#39;) as f:<br>        writer = csv.DictWriter(f, fieldnames=[&quot;input&quot;, &quot;output&quot;, &quot;category&quot;])<br>        writer.writeheader()<br>        for r in records:<br>            writer.writerow({<br>                &quot;input&quot;: r[&quot;input_text&quot;],<br>                &quot;output&quot;: r[&quot;output_text&quot;],<br>                &quot;category&quot;: &quot;education&quot;<br>            })<br><br>convert_to_csv([record], &quot;custom_data.csv&quot;)</pre><h3>Quick Check: Does Your File Pass Validation?</h3><p>Before uploading, make sure your structure is valid. For OpenAI:</p><pre>def validate_openai_format(record):<br>    if &quot;messages&quot; not in record or not isinstance(record[&quot;messages&quot;], list):<br>        return False<br>    for m in record[&quot;messages&quot;]:<br>        if &quot;role&quot; not in m or &quot;content&quot; not in m:<br>            return False<br>    return True</pre><h3>Tips for Better Fine-Tuning Data</h3><ul><li>Include lots of examples that show different use cases.</li><li>Keep prompts and outputs clear and to the point.</li><li>Avoid noisy, repetitive, or conflicting examples.</li><li>Be consistent in structure and punctuation.</li></ul><h3>Final Thoughts</h3><p>Formatting your dataset the right way isn’t just a technical requirement — it’s how you get the model to understand what you want it to do. Whether you’re fine-tuning a model from OpenAI, Anthropic, or Hugging Face, the work starts with clean, well-structured data.</p><p>In a nutshell, “Good formatting = better results”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=954588fe34a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Game On! Scheduling Sports Event for my residential society with Optimization Techniques]]></title>
            <link>https://medium.com/@mohapatra.lohit/game-on-scheduling-fun-for-my-residential-society-with-optimization-techniques-9615ad5508f5?source=rss-cc39f1d41ed7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9615ad5508f5</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[optimization-techniques]]></category>
            <category><![CDATA[problem-solving]]></category>
            <dc:creator><![CDATA[Mohapatra Lohit]]></dc:creator>
            <pubDate>Thu, 16 Jan 2025 14:15:30 GMT</pubDate>
            <atom:updated>2025-01-16T14:23:34.039Z</atom:updated>
            <content:encoded><![CDATA[<p>Organising a society sports day can be as tricky as solving a Rubik’s Cube while juggling. With kids enthusiastically signing up for every game, parents eager to join the fun, and volunteers trying to keep everything running smoothly, how do you schedule it all without chaos? Enter the world of optimization!</p><p><strong>What this article covers:</strong></p><ol><li>Problem Statement</li><li>Optimization Techniques Explored</li><li>Assumption &amp; Approach</li><li>Step-by-Step Solution with Python Code</li><li>Final Schedule and Results</li><li>Adding a Fun Element to the Event</li></ol><h3>The Problem:</h3><blockquote><em>We’re planning to organise a two-day sports event for kids, parents, and families on 18th and 19th Jan 2025. The goal is to:</em></blockquote><ul><li>Schedule all games without overlapping participants.</li><li>Allocate volunteers effectively.</li><li>Wrap up each day activities within 10.30–1.30 pm, including breaks and briefing before each game.</li><li>Balance games for fun, fairness of workload on volunteers, and efficiency.</li><li>One of the challenges is to complete the sports for adults on 18th Jan and ensure kids sports events take place on 19th Jan.</li></ul><p><strong>Data:</strong><br>We shared a google drive excel with our society and asked them to fill up the participation details in it. The details filled were not quite standardized, so we had to clean the data and segregate it to different datasets one each for kids, women and men. Once the cleaning of the data was done, the generated datasets were used for further processing.</p><h3>The Challenge:</h3><blockquote><em>The complexity arises when participants sign up for multiple games. For example, Sanjay and Neelam want to play every game. How do we ensure they aren’t playing two games at the same time? And let’s not forget our 4 hardworking volunteers!</em></blockquote><p>This is where optimization techniques come into play.</p><h3>Exploring Optimization Techniques:</h3><p>Let’s explore the different approaches:</p><ol><li><strong>Graph Coloring</strong>: A promising approach for scheduling but couldn’t handle additional constraints like volunteer allocation and breaks.</li><li><strong>Integer Linear Programming (ILP)</strong>: The winner! It handles scheduling, volunteer allocation, and time optimization mathematically.</li></ol><h3>Assumptions and Approach</h3><ol><li><strong>Game Categories</strong>: Games are divided into:</li></ol><ul><li><strong>Women’s Games</strong>: Tug of War, Musical Chair, Belan Race, etc.</li><li><strong>Men’s Games</strong>: Tug of War, TT, Hula Hoop, etc.</li><li><strong>Family/Group Games</strong>: Family Relay Race, Ball Pass Game, etc.</li></ul><p><strong>2. Constraints</strong>:</p><ul><li>Each family can participate in one or more categories but not overlap across time slots.</li><li>Total event duration is limited to 3 hours per day.</li><li>Adequate transition times (5–10 minutes) between games for briefing/setup.</li><li>Volunteers (if any) will be allocated uniformly.</li></ul><p><strong>3. Optimization Goals</strong>:</p><ul><li>No overlapping time slots for families across games.</li><li>Time slots for efficient execution (minimized gaps or delays).</li></ul><h3>Step-by-Step Solution</h3><p>The solution approach:</p><blockquote><em>We used </em><strong><em>Python with OR-Tools</em></strong><em> to model this as an ILP problem. The solution dynamically assigns time slots for kids, parents, and family games while ensuring no participant overlaps. Volunteers are scheduled too!</em></blockquote><p><strong>Key Steps:</strong></p><ol><li>Define time slots and constraints.</li><li>Assign games to slots ensuring no participant overlaps.</li><li>Allocate volunteers evenly.</li><li>Add time gaps for transitions and breaks.</li></ol><h3>Step 1: Schedule Adult Games on Day 1</h3><h4>Constraints:</h4><ol><li><strong>No Overlap of Participants</strong>: A participant cannot participate in two games at the same time.</li><li><strong>Parallel Activities Allowed</strong>: Games that do not share participants can happen simultaneously.</li><li><strong>Volunteer Allocation</strong>: Each game should have at least one volunteer assigned. Parallel games require separate volunteers.</li><li><strong>Time Slot Optimization</strong>: Minimize total time slots to complete all games within 1.5 hours (6 slots of ~15 minutes each).</li></ol><h4>Approach for Scheduling Adult Games (Day 1)</h4><ul><li><strong>Algorithm</strong>: Use <strong>graph coloring</strong> to assign time slots.</li><li>Represent games as graph nodes.</li><li>Connect two nodes with an edge if the games share participants.</li><li>Use the smallest number of colors (time slots) to color the graph.</li><li><strong>Input Data</strong>:</li><li>List of games for men and women.</li><li>Participants in each game.</li></ul><h3>Step 2: Schedule Family and Kid Games on Day 2</h3><h4>Constraints:</h4><ol><li><strong>Family Games Last</strong>: Family games are scheduled at the end of Day 2.</li><li><strong>Mixed Participation</strong>: Adults from Day 1 may participate in family games with kids.</li><li><strong>Avoid Overlaps</strong>: Use the same graph-coloring approach for family games.</li></ol><h3>Step 3: Assign Volunteers</h3><h4>Constraints:</h4><ol><li><strong>6 Volunteers Total</strong>: Allocate across parallel games.</li><li><strong>Fair Distribution</strong>: Ensure no volunteer is overloaded.</li><li><strong>Volunteer Skills</strong>: Match volunteers with their preferred or skilled game types, if applicable.</li></ol><h4>Approach for Volunteer Allocation</h4><ul><li>Use a <strong>bin-packing algorithm</strong>:</li><li>Treat volunteers as bins.</li><li>Assign games to bins based on the number of parallel games in a time slot.</li><li>Minimize the maximum load per bin (volunteer).</li></ul><h3>Difference Between ILP and Graph Coloring / Bin-Packing</h3><ol><li><strong>Graph Coloring</strong>:</li></ol><ul><li>Graph coloring is a heuristic algorithm.</li><li>It assigns colors (time slots) to nodes (games) to avoid conflicts (overlapping participants).</li><li>It’s fast and works well for small to medium-scale problems but doesn’t always yield the most optimized schedule (e.g., minimizing time slots or balancing volunteer workload).</li></ul><p><strong>2. Bin-Packing</strong>:</p><ul><li>Focuses on distributing tasks (games) across bins (volunteers or time slots).</li><li>Assumes tasks are independent, which may not handle participant overlaps or scheduling constraints efficiently.</li></ul><p><strong>3. ILP</strong>:</p><ul><li>ILP uses a mathematical approach to find an optimal solution by explicitly encoding all constraints (e.g., participant conflicts, volunteer limits, minimizing time slots).</li><li>It evaluates all feasible solutions within the constraints and ensures the most optimal result.</li><li><strong>Best suited</strong> for problems with complex interdependencies between games, participants, and resources.</li></ul><h3>Using ILP for Scheduling Adult Games</h3><p>We can define an ILP problem to:</p><ol><li>Minimize the total time slots used.</li><li>Ensure no overlapping participants in games scheduled simultaneously.</li><li>Allocate volunteers to games such that the workload is balanced.</li></ol><h4>Benefits of ILP</h4><ol><li><strong>Minimizes Time Slots</strong>: Ensures the fewest time slots are used while avoiding overlaps.</li><li><strong>Handles Complex Constraints</strong>: Accurately models participant conflicts, volunteer limits, and resource constraints.</li><li><strong>Optimized Volunteer Allocation</strong>: Balances the workload across all volunteers.</li></ol><h3>The Code:</h3><p>Python code in a structured way:</p><pre>import pandas as pd<br>import networkx as nx<br>import matplotlib.pyplot as plt<br>from pulp import LpProblem, LpVariable, LpBinary, lpSum, PULP_CBC_CMD<br>import random<br><br># Input Data for Day 1 and Day 2 (Dummy Data)<br>men_games_day1 = {<br>    &quot;men_tug_of_war&quot;: [&quot;John Doe&quot;, &quot;David Smith&quot;, &quot;Paul Brown&quot;, &quot;Michael Johnson&quot;, &quot;Chris Lee&quot;, &quot;James Wilson&quot;],<br>    &quot;men_chess&quot;: [&quot;David Smith&quot;, &quot;Paul Brown&quot;, &quot;Michael Johnson&quot;],<br>    &quot;men_carrom&quot;: [&quot;John Doe&quot;, &quot;David Smith&quot;, &quot;Chris Lee&quot;, &quot;James Wilson&quot;],<br>    &quot;men_tt&quot;: [&quot;Michael Johnson&quot;, &quot;Chris Lee&quot;]<br>}<br><br>women_games_day1 = {<br>    &quot;women_tug_of_war&quot;: [&quot;Sophia Turner&quot;, &quot;Emma Harris&quot;, &quot;Olivia Clark&quot;, &quot;Ava Lewis&quot;, &quot;Mia Walker&quot;, &quot;Charlotte Scott&quot;],<br>    &quot;women_musical_chair&quot;: [&quot;Sophia Turner&quot;, &quot;Emma Harris&quot;, &quot;Olivia Clark&quot;, &quot;Ava Lewis&quot;, &quot;Mia Walker&quot;],<br>    &quot;women_belan_race&quot;: [&quot;Charlotte Scott&quot;, &quot;Sophia Turner&quot;, &quot;Olivia Clark&quot;],<br>    &quot;women_book_balance&quot;: [&quot;Emma Harris&quot;, &quot;Ava Lewis&quot;, &quot;Mia Walker&quot;, &quot;Charlotte Scott&quot;],<br>    &quot;women_blind_fold_drawing&quot;: [&quot;Sophia Turner&quot;]<br>}<br><br>kids_games_day2 = {<br>    &quot;hopping_game&quot;: [&quot;Aarav&quot;, &quot;Neelam&quot;, &quot;Isha&quot;, &quot;Nina&quot;, &quot;Sanjay&quot;, &quot;Kabir&quot;],<br>    &quot;slow_cycle_race&quot;: [&quot;Aditya&quot;, &quot;Riya&quot;, &quot;Ananya&quot;, &quot;Ishaan&quot;, &quot;Yash&quot;, &quot;Nitya&quot;],<br>    &quot;musical_chair&quot;: [&quot;Aryan&quot;, &quot;Riya&quot;, &quot;Sanjay&quot;, &quot;Aarav&quot;, &quot;Kabir&quot;, &quot;Ishaan&quot;],<br>    &quot;ping_pong_toss&quot;: [&quot;Aarav&quot;, &quot;Nitya&quot;, &quot;Sanjay&quot;, &quot;Ananya&quot;, &quot;Kabir&quot;, &quot;Yash&quot;],<br>    &quot;three_leg_race&quot;: [&quot;Ishaan&quot;, &quot;Ananya&quot;, &quot;Nitya&quot;, &quot;Sanjay&quot;, &quot;Aarav&quot;],<br>    &quot;puzzle_game&quot;: [&quot;Kabir&quot;, &quot;Riya&quot;, &quot;Ishaan&quot;, &quot;Aryan&quot;, &quot;Neelam&quot;, &quot;Yash&quot;],<br>}<br><br># Combine all games for scheduling (Day 1 Men, Women, and Day 2 Kids)<br>all_games_day1 = {**men_games_day1, **women_games_day1}<br>all_games_day2 = kids_games_day2<br><br># Volunteer Data<br>volunteers = [&quot;John&quot;, &quot;Alice&quot;, &quot;Bob&quot;, &quot;Emma&quot;, &quot;Mike&quot;, &quot;Sarah&quot;, &quot;David&quot;, &quot;Sophia&quot;, &quot;Daniel&quot;, &quot;Liam&quot;, &quot;Olivia&quot;, &quot;James&quot;]<br><br># Ensure equal distribution of volunteers between Day 1 and Day 2<br># Shuffle and split the volunteers into two groups for Day 1 and Day 2<br>random.seed(42)<br>random.shuffle(volunteers)<br><br># Split volunteers equally<br>day1_volunteers = volunteers[:len(volunteers)//2]<br>day2_volunteers = volunteers[len(volunteers)//2:]<br><br># Helper function to assign 2 volunteers to each event<br>def assign_volunteers_to_games(games, volunteers):<br>    volunteer_assignments = {}<br>    for game in games:<br>        # Select 2 volunteers randomly without replacement for each event<br>        assigned_volunteers = random.sample(volunteers, 2)<br>        volunteer_assignments[game] = assigned_volunteers<br>    return volunteer_assignments<br><br># Assign volunteers to Day 1 and Day 2 games<br>volunteer_assignments_day1 = assign_volunteers_to_games(all_games_day1, day1_volunteers)<br>volunteer_assignments_day2 = assign_volunteers_to_games(all_games_day2, day2_volunteers)<br><br># Time slots for each day (10:30 AM to 1:30 PM, 6 slots of 30 minutes each)<br>time_slots = list(range(6))  # 0-5<br>timings = {0: &quot;10:30-11:00&quot;, 1: &quot;11:00-11:30&quot;, 2: &quot;11:30-12:00&quot;, 3: &quot;12:00-12:30&quot;, 4: &quot;12:30-1:00&quot;, 5: &quot;1:00-1:30&quot;}<br><br>def schedule_games(games):<br>    # ILP Problem<br>    prob = LpProblem(&quot;Game_Scheduling&quot;, sense=1)<br><br>    # Decision variables<br>    x = LpVariable.dicts(&quot;x&quot;, ((game, t) for game in games for t in time_slots), cat=LpBinary)<br><br>    # Objective: Minimize time slots used<br>    prob += lpSum([t * x[(game, t)] for game in games for t in time_slots]), &quot;Minimize_Time_Slots&quot;<br><br>    # Each game must be in one slot<br>    for game in games:<br>        prob += lpSum([x[(game, t)] for t in time_slots]) == 1, f&quot;Game_Assignment_{game}&quot;<br><br>    # No participant overlap based on FlatNo<br>    participants = {game: set(players) for game, players in games.items()}<br>    for t in time_slots:<br>        for g1 in games:<br>            for g2 in games:<br>                if g1 != g2 and participants[g1] &amp; participants[g2]:<br>                    prob += x[(g1, t)] + x[(g2, t)] &lt;= 1, f&quot;No_Overlap_{g1}_{g2}_Slot_{t}&quot;<br><br>    # Solve problem<br>    prob.solve(PULP_CBC_CMD(msg=False))<br><br>    # Extract schedule<br>    schedule = {}<br>    for game in games:<br>        for t in time_slots:<br>            if x[(game, t)].varValue == 1:<br>                schedule[game] = t<br>    return schedule<br><br># Schedule games for Day 1 and Day 2<br>schedule_day1 = schedule_games(all_games_day1)<br>schedule_day2 = schedule_games(all_games_day2)<br><br># Format results and sort by time slot for each day<br>def format_schedule(schedule, games, volunteer_assignments, day):<br>    results = []<br>    for game, slot in schedule.items():<br>        assigned_volunteers = &quot;, &quot;.join(volunteer_assignments.get(game, [&quot;Unassigned&quot;]))<br>        results.append({<br>            &quot;Day&quot;: day,<br>            &quot;Sport&quot;: game,<br>            &quot;Participants&quot;: &quot;, &quot;.join(games[game]),<br>            &quot;Volunteers&quot;: assigned_volunteers,<br>            &quot;Time Slot&quot;: timings[slot],<br>            &quot;Time Slot ID&quot;: slot  # Add the slot ID to facilitate sorting<br>        })<br>    <br>    # Create DataFrame<br>    df = pd.DataFrame(results)<br>    <br>    # Sort by Time Slot ID (ascending)<br>    df_sorted = df.sort_values(by=[&quot;Day&quot;, &quot;Time Slot ID&quot;]).drop(columns=[&quot;Time Slot ID&quot;])<br>    <br>    return df_sorted<br><br># Format and display final sorted schedule<br>df_day1 = format_schedule(schedule_day1, all_games_day1, volunteer_assignments_day1, &quot;Day 1&quot;)<br>df_day2 = format_schedule(schedule_day2, all_games_day2, volunteer_assignments_day2, &quot;Day 2&quot;)<br>final_schedule = pd.concat([df_day1, df_day2])<br><br># Display final sorted schedule<br>print(&quot;Final Schedule with Volunteers (Sorted by Time Slot):&quot;)<br>print(final_schedule)<br><br># Build game graph<br>def build_game_graph(games):<br>    G = nx.Graph()<br>    for game in games:<br>        G.add_node(game)<br>    for g1 in games:<br>        for g2 in games:<br>            if g1 != g2 and set(games[g1]) &amp; set(games[g2]):<br>                G.add_edge(g1, g2)<br>    return G<br><br>graph_day1 = build_game_graph(all_games_day1)<br>graph_day2 = build_game_graph(all_games_day2)<br><br># Plot graphs<br>def plot_graph(G, title):<br>    plt.figure(figsize=(10, 6))<br>    pos = nx.spring_layout(G, seed=42)<br>    nx.draw(G, pos, with_labels=True, node_size=3000, node_color=&quot;lightblue&quot;, font_size=10, font_weight=&quot;bold&quot;, edge_color=&quot;gray&quot;)<br>    plt.title(title, fontsize=14)<br>    plt.show()<br><br>plot_graph(graph_day1, &quot;Game Graph - Day 1 (Men and Women Games)&quot;)<br>plot_graph(graph_day2, &quot;Game Graph - Day 2 (Kids Games)&quot;)</pre><p><strong>Output</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C3XNdWDXRN7qKPPFcpLl_w.png" /><figcaption><strong>Generated Schedule</strong></figcaption></figure><p><strong>Generated Graphs</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1QzCxDkDcqMO_840nQgCrQ.png" /><figcaption><strong>Day 1 Sports Graph</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1mdPnxVeA9RuSrtbQ5bTlA.png" /><figcaption>Day 2 Sports Graph</figcaption></figure><h3>Conclusion:</h3><p>Motivational note:</p><blockquote><em>Scheduling this event was no less than a marathon itself! But with a little math, coding, and a lot of heart, we ensured that every participant had a chance to shine. Optimization isn’t just for tech — it’s for life too.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9615ad5508f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>