}
private void addEdges(SerializedNarrative.TrainInstance trainInstance,
List<SerializedNarrative.Event> events) throws IOException {
TrackIdentifier prevId = null;
long prevTime = 0;
BerthStepIdentifier prevBerthStepId = null;
long prevBerthStepTime = 0;
for (SerializedNarrative.Event event : events) {
TrackIdentifier id = getTrackIdentifierForEvent(event);
if (id != null) {
if (prevId != null) {
int duration = (int) ((event.getTimestamp() - prevTime) / 1000);
_graph.addEdge(prevId, id, duration);
logEdge(prevId, id, trainInstance);