mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-10-31 18:37:48 +08:00 
			
		
		
		
	fix(graph): enhance the judgment of boundary conditions for removeEdge functions (#1412)
This commit is contained in:
		| @ -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'); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -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'); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -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'); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -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'); | ||||||
|         } |         } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 砖吐筷筷
					砖吐筷筷