How to actually teach the ANN the resulting weights of different training inputs?
Your network must have something which persist like weights add bias

Your new implementation would be like this : 

trainingData = [{in: [0,0], out:[0]}, {in: [0,1], out:[0]}, ...];
iterations = 10000

network = graphNodesToNetwork()
links = graphLinksToNetwork()
randomiseLinkWeights(links)
weights = []


while(trainingData not empty) {
    for(0&lt;iterations) { 
       set = trainingData.pop()

       weights = updateInput(network, set.in)

       forwardPropagate(network, links) 

       linkUpdate = backPropagate(network, links, set.out, weights)

       updateLinks(linkUpdate, links)}
}


Inshort retain weights, and backprapogate.