JSFiddle - React, Tailwind, and code Playground

JavaScript

//The functions linkNodes and unlinkNodes should add and remove nodes links from the directed graph, respectively.
var nodes = new Object();

function linkNodes(a, b){
    //a should be a string, and b should be a string as well
    //create the node a, if it doesn't exist yet
    //create the node b, if it doesn't exist yet
    //link the node a to the node b
}

function unlinkNodes(){
    //unlink the nodes a and b, if a and b exist
    //create the node a, if it doesn't exist yet
}

function getNode(string){
    //get the node that corresponds to the string
    //if the string doesn't exist, then return false
}