Compare commits

...

2 commits

Author SHA1 Message Date
砖吐筷筷
ee1460b8d0
Merge bc0e32af57 into 6a74972080 2024-11-13 18:38:44 +08:00
ztkuaikuai
bc0e32af57 fix(graph): enhance the judgment of boundary conditions for removeEdge functions 2024-07-07 18:40:23 +08:00
4 changed files with 8 additions and 4 deletions

View file

@ -46,7 +46,8 @@ class GraphAdjList {
if ( if (
!this.adjList.has(vet1) || !this.adjList.has(vet1) ||
!this.adjList.has(vet2) || !this.adjList.has(vet2) ||
vet1 === vet2 vet1 === vet2 ||
this.adjList.get(vet1).indexOf(vet2) === -1
) { ) {
throw new Error('Illegal Argument Exception'); throw new Error('Illegal Argument Exception');
} }

View file

@ -46,7 +46,8 @@ class GraphAdjList {
if ( if (
!this.adjList.has(vet1) || !this.adjList.has(vet1) ||
!this.adjList.has(vet2) || !this.adjList.has(vet2) ||
vet1 === vet2 vet1 === vet2 ||
this.adjList.get(vet1).indexOf(vet2) === -1
) { ) {
throw new Error('Illegal Argument Exception'); throw new Error('Illegal Argument Exception');
} }

View file

@ -46,7 +46,8 @@ class GraphAdjList {
if ( if (
!this.adjList.has(vet1) || !this.adjList.has(vet1) ||
!this.adjList.has(vet2) || !this.adjList.has(vet2) ||
vet1 === vet2 vet1 === vet2 ||
this.adjList.get(vet1).indexOf(vet2) === -1
) { ) {
throw new Error('Illegal Argument Exception'); throw new Error('Illegal Argument Exception');
} }

View file

@ -46,7 +46,8 @@ class GraphAdjList {
if ( if (
!this.adjList.has(vet1) || !this.adjList.has(vet1) ||
!this.adjList.has(vet2) || !this.adjList.has(vet2) ||
vet1 === vet2 vet1 === vet2 ||
this.adjList.get(vet1).indexOf(vet2) === -1
) { ) {
throw new Error('Illegal Argument Exception'); throw new Error('Illegal Argument Exception');
} }