def get_node_color_map(selected_events):
    """Generate color map for all organism groups in selected_events.

    This is done dynamically for each node-link diagram, because it 
    minimizes collisions.

    :param selected_events: Specified organism_group-organism_group
    relationships inside nested dictionary.
    :type selected_events: dict[str, dict[str, None]]
    :return: organism_group and their assigned hex codes.
    :rtype: dict[str, str]
    """
    # https://colorbrewer2.org/?type=qualitative&scheme=Set1&n=9
    colour_scheme = [
        "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33",
        "#a65628", "#f781bf", "#999999"
    ]

    acc = 0
    color_map = {}
    for organism_group in selected_events:
        if len(selected_events[organism_group]):
            color_map[organism_group] = colour_scheme[acc % len(colour_scheme)]
            acc += 1

    return color_map