|
|
@ -278,68 +278,5 @@ TEST(GraphTest, kshortest) { |
|
|
|
|
|
|
|
// TODO: actually write tests here
|
|
|
|
|
|
|
|
/*
|
|
|
|
std::queue<uint_fast64_t> nodeQueue; |
|
|
|
for (uint_fast64_t initialNode : model->getInitialStates()) { |
|
|
|
for (uint_fast64_t succ : shortestPathSuccessors[initialNode]) { |
|
|
|
nodeQueue.push(succ); |
|
|
|
} |
|
|
|
storm::storage::sparse::path<double> path; |
|
|
|
path.tail_k = 1; |
|
|
|
path.distance = dijkstraDistance[initialNode]; |
|
|
|
assert(path.distance == 1); |
|
|
|
kShortestPaths[initialNode].push_back(path); |
|
|
|
} |
|
|
|
|
|
|
|
// Dijkstra BFS
|
|
|
|
while (!nodeQueue.empty()) { |
|
|
|
uint_fast64_t currentNode = nodeQueue.front(); |
|
|
|
nodeQueue.pop(); |
|
|
|
|
|
|
|
for (auto succ : shortestPathSuccessors[currentNode]) { |
|
|
|
nodeQueue.push(succ); |
|
|
|
} |
|
|
|
|
|
|
|
storm::storage::sparse::path<double> path; |
|
|
|
path.tail = shortestPathPredecessor[currentNode]; |
|
|
|
path.tail_k = 1; |
|
|
|
path.distance = dijkstraDistance[currentNode]; |
|
|
|
kShortestPaths[currentNode].push_back(path); |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
// FIXME: ~~treat starting node(s) separately~~ actually, this whole thing should be done differently:
|
|
|
|
// first I need to run over the Dijkstra result and make a tree (as vector of vectors) of successors,
|
|
|
|
// then walk that tree DF/BF
|
|
|
|
/*
|
|
|
|
for (auto node : model->getInitialStates()) { |
|
|
|
storm::storage::sparse::path<double> p = {}; |
|
|
|
p.distance = dijkstraDistance[node]; |
|
|
|
assert(p.distance == 1); |
|
|
|
kShortestPaths[node].emplace_back(p); |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
// shortest paths are stored recursively, so the predecessor must always be dealt with first
|
|
|
|
// by considering the nodes in order of distance, we should have roughly the correct order,
|
|
|
|
// but not quite: in the case s ~~~> u -1-> v, v might be listed before u, in which case it must be deferred
|
|
|
|
/*
|
|
|
|
while (!nodeQueue.empty()) { |
|
|
|
std::pair<double, uint_fast64_t> distanceStatePair = nodeQueue.front(); |
|
|
|
nodeQueue.pop(); |
|
|
|
|
|
|
|
uint_fast64_t currentNode = distanceStatePair.second; |
|
|
|
|
|
|
|
uint_fast64_t predecessor = shortestPathPredecessors[currentNode]; |
|
|
|
if (kShortestPaths[predecessor].empty) { |
|
|
|
// we need to take care of the predecessor first; defer this one
|
|
|
|
nodeQueue.emplace(currentNode); |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
//shortestPaths[currentNode].emplace(predecessor, 1, )
|
|
|
|
} |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
EXPECT_TRUE(false); |
|
|
|
} |
|
|
|
} |