mirror of
https://github.com/zrwusa/data-structure-typed.git
synced 2024-11-23 12:54:04 +00:00
fix: In Graph data structures, only use 'undefined' and abandon the design where both 'null' and 'undefined' coexist.
This commit is contained in:
parent
f3df66eef3
commit
7da4f8add9
|
@ -36,11 +36,11 @@ class MyGraph<
|
|||
return new MyEdge(srcOrV1, destOrV2, weight, value) as EO;
|
||||
}
|
||||
|
||||
deleteEdge(edge: EO): EO | null {
|
||||
deleteEdge(edge: EO): EO | undefined {
|
||||
return edge;
|
||||
}
|
||||
|
||||
getEdge(srcOrKey: VertexKey, destOrKey: VertexKey): EO | null {
|
||||
getEdge(srcOrKey: VertexKey, destOrKey: VertexKey): EO | undefined {
|
||||
return new MyEdge(srcOrKey, destOrKey) as EO;
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,8 @@ class MyGraph<
|
|||
return [new MyVertex(a, 'b') as VO];
|
||||
}
|
||||
|
||||
getEndsOfEdge(edge: EO): [VO, VO] | null {
|
||||
return edge ? null : null;
|
||||
getEndsOfEdge(edge: EO): [VO, VO] | undefined {
|
||||
return edge ? undefined : undefined;
|
||||
}
|
||||
|
||||
protected _addEdgeOnly(edge: EO): boolean {
|
||||
|
|
Loading…
Reference in a new issue