Change Colors of Selected Nodes in Visdcc Network Graph

Solution 1:

You just need to distinguish the source and destination nodes from the other ones.

A quick fix for doing this is adding an if condition when creating the nodes list, like so:

    nodes = [
        ({
            'id': node_name, 
            'label': node_name,
            'color': "red",
            'shape':'dot',
            'size':15
        })
        if node_name == character_select1 or node_name == character_select2
        else
        ({
            'id': node_name, 
            'label': node_name,
            'color': "green",
            'shape':'dot',
            'size':15
        })
        for _, node_name in enumerate(node_list)
    ]

This will colour the specified nodes in red and the intermediate/irrelevant ones as green.