Skip to content

Commit

Permalink
Fix path selection
Browse files Browse the repository at this point in the history
Co-authored-by: claudiolor <[email protected]>
  • Loading branch information
morpheusthewhite and claudiolor committed Jul 8, 2020
1 parent 082d3a8 commit b87ba80
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/GraphParallelDFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,25 @@ void GraphParallelDFS::convertToDT() {

// check that node has more than 1 child before adding it to the path
// otherwise it will never be a decision point for the path selection
if (first_child != ending_child)
if(Br.empty())
Br.push_back(node);

unsigned long int pathSize = Br.size();
Br.resize(pathSize + 1);

for (int j = first_child; j < ending_child; j++) {
int child = this->Ai_dag[j];

// lock mutex to access shared resources (paths and incoming_edges)
node_mutexes[child].lock();

// best path to child
vector<int> Qr = paths[child];
// add to current path the current child
Br[pathSize] = child;

// update the path in the case in which
// - The path is empty, so this is the first time we meet this child
// - We found a path Br which is better than the current one
if (Qr.empty() || Br <= Qr) {
if (paths[child].empty() || Br <= paths[child]) {
paths[child] = Br;

// the previous one, if existing, is a parent in the dag which is not present in the dt
Expand Down

0 comments on commit b87ba80

Please sign in to comment.