Skip to content

Commit

Permalink
✨ created Cycle.path
Browse files Browse the repository at this point in the history
- returns a list of vertices that make up the cycle's path
  • Loading branch information
rodigu committed Apr 7, 2022
1 parent b992a3b commit 76ef202
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,10 @@ export class Cycle extends Network {
return 0;
}

get path(): base_id[] {
return [...this.vertices.keys()];
}

/**
* Returns true if the cycle is closed, otherwise returns false.
* @returns boolean
Expand Down
9 changes: 6 additions & 3 deletions tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ function generalTesting() {
// compareQuadAlgorithms(nex.genCompleteNetwork(10), true);
// randomNetEfficiencyTest(20, { min: 20, max: 120 }, "rand_dense.json");

const start = Date.now();
const net = await nex.loadAdjacencyMatrix("./data/networkMatrix.csv");
console.log(net.triplets().length, Date.now() - start);
// const start = Date.now();
// const net = await nex.loadAdjacencyMatrix("./data/networkMatrix.csv");
// console.log(net.triplets().length, Date.now() - start);

const net = nex.genCompleteNetwork(4);
console.log(net.quadruplets().map(({ path }) => path));

0 comments on commit 76ef202

Please sign in to comment.