Skip to content

Commit

Permalink
#204 refactor: rename functions for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnotchung committed Oct 28, 2024
1 parent 1338a99 commit 19abae7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/object/src/hashgraph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export class HashGraph {
return test1 || test2;
}

private _areCausallyRelatedUsingBFS(start: Hash, target: Hash): boolean {
private _areCausallyRelated(start: Hash, target: Hash): boolean {
const visited = new Set<Hash>();
const queue: Hash[] = [];
let head = 0;
Expand Down Expand Up @@ -255,11 +255,10 @@ export class HashGraph {
return false;
}

// Time complexity: O(V), Space complexity: O(V)
areCausallyRelatedUsingBFS(hash1: Hash, hash2: Hash): boolean {
areCausallyRelated(hash1: Hash, hash2: Hash): boolean {
return (
this._areCausallyRelatedUsingBFS(hash1, hash2) ||
this._areCausallyRelatedUsingBFS(hash2, hash1)
this._areCausallyRelated(hash1, hash2) ||
this._areCausallyRelated(hash2, hash1)
);
}

Expand Down

0 comments on commit 19abae7

Please sign in to comment.