-
Notifications
You must be signed in to change notification settings - Fork 326
/
exo1.R
29 lines (22 loc) · 751 Bytes
/
exo1.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
exo1 <- function(x0,W){
####
# Implement the Dijkstra algorithm by iterating these step while the
# stack |I| is non empty.
# Display from time to time the front that propagates.
####
n <- dim(W)[1]
pstart <- t(t(x0))
DIJSTRA <- perform_dijstra_fm(W, pstart, Inf,'dijstr', 'sym',n*6)
D <- DIJSTRA$D ; Dsvg <- DIJSTRA$Dsvg ; Ssvg <- DIJSTRA$Ssvg
par(mfrow=c(2,2))
for (i in 1:4){
d <- Dsvg[,,i]
d[d==Inf] <- 0
d <- as.cimg( t(as.matrix(d)) )
cmap_jet <- function(v){ return( rgb(v,
(sin(v*2*pi)+1)/2,
(cos(v*2*pi)+1)/2) ) }
plot(d, colourscale=cmap_jet, interpolate = FALSE, axes = FALSE)
}
return(D)
}