Fix when len is not used
This commit is contained in:
parent
b09465e8a5
commit
4d3f63e00f
|
@ -371,7 +371,14 @@ class Graphs {
|
|||
var dt = splitted.split(sep.dotToLength);
|
||||
if (dt.length == 2) {
|
||||
dot.add(int.parse(dt[0]));
|
||||
if (_useLength) {
|
||||
len.add(int.parse(dt[1]));
|
||||
} else {
|
||||
len.add(0);
|
||||
}
|
||||
} else if (dt.length == 1) {
|
||||
dot.add(int.parse(splitted));
|
||||
len.add(0);
|
||||
}
|
||||
}
|
||||
_dots.add(Dot.fromTwoLists(name, dot, len));
|
||||
|
@ -503,5 +510,29 @@ class Graphs {
|
|||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
void dijkstra(int source) {
|
||||
/*
|
||||
create vertex set Q;
|
||||
|
||||
for each vertex v in Graph{
|
||||
dist[v] ← INFINITY ;
|
||||
prev[v] ← UNDEFINED ;
|
||||
add v to Q;}
|
||||
dist[source] ← 0;
|
||||
|
||||
while Q is not empty{
|
||||
u ← vertex in Q with min dist[u]
|
||||
|
||||
remove u from Q
|
||||
|
||||
for each neighbor v of u still in Q{
|
||||
alt ← dist[u] + length(u, v);
|
||||
if alt < dist[v]: {
|
||||
dist[v] ← alt;
|
||||
prev[v] ← u;}
|
||||
}}
|
||||
return dist[], prev[]*/
|
||||
}
|
||||
//************Алгоритмы************
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue