It seems that what you are calculating in your loop is not the adjacency matrix, but the weighted distance of the shortest path. Anyway, the way to do either of these operations is to add a weight attribute to the edges, which represents the difference in times. This is then much easier to deal with than the attributes of the vertices. Here's an idea:
# your code
require(igraph)
g1 <- erdos.renyi.game(10, 0.5)
V(g1)$time <- 1:10
# adding a weight (difference in times)
E(g1)$weight <- apply(get.edgelist(g1), 1, function(i){
abs(V(g1)$time[i[1]]-V(g1)$time[i[2]])
})
# calculate adjacency and/or shortest path.
get.adjacency(g1, attr="weight")
shortest.paths(g1)
EDIT It seems that the difference you would like to calculate has nothing to do with the graph at all. You are probably just looking for outer
:
outer(V(g1)$time, V(g1)$time, "-")