I am working on a code that helps me determine the minimum distance between two nodes if I have a succession of them, in my code when the weight is an integer it works perfectly, but if I put a decimal a part works and then it marks me $<- .data.frame(
tmp`, "i", value = 5) : replacement has 1 row, data has 0 and I can't find the error, could you help me?
My code is the following
The part where my code fails is this:
p[r]<- min(Aristas[Aristas$From==i,"Peso"]+p[r-1])
Aristas[Aristas$From==i&Aristas$Peso==p[r]-p[r-1],]$Estado<-1
Aristas[Aristas$From==i&Aristas$Peso==p[r]-p[r-1],]$Color<-colorarista
Aristas[Aristas$From==i&Aristas$Peso==p[r]-p[r-1],]$PesoAc<-p[r]
Edges contains the data of "From", "To","Peso","PesoAc","Estado" ,"i", "Color"
ii is where the union of the nodes comes from
the data is as follows
|From|To|Peso|PesoAc|Estado|i|Color|
1 2 1.485 0 0 0 black
2 3 2.485 0 0 0 black
3 4 3.485 0 0 0 black
4 5 4.485 0 0 0 black
5 6 5.485 0 0 0 black
6 7 6.485 0 0 0 black
7 8 7.485 0 0 0black