Skip to content

Commit

Permalink
save ref to edges in eventour
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed May 24, 2014
1 parent dba58db commit 3c3780b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions js/src/001 undirected/offline/algo/eulerian/eventour.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var eventour_t = function(){
* @param list tour the output tour
*/

var eventour = function(g, V, i, free, done, it, tour){
var eventour = function(g, V, i, free, done, it, tour, edges){

var u, j, z = [i, 0];

Expand All @@ -32,9 +32,10 @@ var eventour_t = function(){

while(true){
var end = true;
it[i] = g.eitr(u, function(_, v){
it[i] = g.eitr(u, function(e, v){
if(free[i][v[0]] > 0){
tour.splice(j, 0, i);
edges.splice(j, 0, e);
u = v;

++j;
Expand Down
2 changes: 1 addition & 1 deletion test/js/src/undirected/offline/algo/eulerian/eventour.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var check = function(label, n, x, E, _E){
var it = gn.sqmat(1, n, undefined);
var tour = [];

eventour(g, v, x, free, done, it, tour);
eventour(g, v, x, free, done, it, tour, []);

deepEqual(tour.length, E.length, 'check length');
deepEqual(free, gn.sqmat(2, n, 0), 'check free');
Expand Down

0 comments on commit 3c3780b

Please sign in to comment.