The Angular PWA Demo includes multiple algorithm visualizations that demonstrate core computer science concepts with interactive canvas-based graphics.
Implements Dijkstra’s algorithm for finding the shortest path between nodes in a weighted graph. The visualization displays vertices and edges on an HTML5 canvas.
// src/app/_modules/_Demos/_DemosFeatures/algorithm/algorithm-dijkstra/algorithm-dijkstra.component.ts_GetGraph():void { let _vertexSize : number = Number.parseInt(this._vertexSizeList.nativeElement.value); let _sourcePoint : number = Number.parseInt(this._sourcePointList.nativeElement.value); this.getGraphIdle = true; let randomVertexInfo! : Observable<string>; let _progLangId : number = Number.parseInt(this._languajeList.nativeElement.value); switch(_progLangId) { case 1: // C# randomVertexInfo = this.algorithmService.getRandomVertex(_vertexSize, _sourcePoint); break; case 2: // C++ randomVertexInfo = this.algorithmService.getRandomVertexCpp(_vertexSize, _sourcePoint); break; case 3: // Spring Boot randomVertexInfo = this.algorithmService.getRandomVertexSpringBoot(_vertexSize, _sourcePoint); break; } randomVertexInfo.subscribe(randomVertexObserver);}
// src/app/_modules/_Demos/_DemosFeatures/algorithm/algorithm-sort/algorithm-sort.component.tspublic GetSort() { let selectedIndex : number = this.SortAlgorithmList.nativeElement.options.selectedIndex; let p_sortAlgorith : number = this.SortAlgorithmList.nativeElement.options[selectedIndex].value; if (p_sortAlgorith == 0) { this.status_message.set('PLEASE SELECT AN ALGORITHM'); return; } let _p_unsortedList : string = this.mensajes.nativeElement.innerHTML; let GetSortInfo! : Observable<string>; let _progLangId : number = Number.parseInt(this._languajeList.nativeElement.value); switch(_progLangId) { case 1: // C# GetSortInfo = this.algorithmService.SortBenchMark_getSort_C_Sharp(p_sortAlgorith, p_unsortedList); break; case 2: // C++ GetSortInfo = this.algorithmService.getSort_CPP(p_sortAlgorith, p_unsortedList); break; } GetSortInfo.subscribe(GetSortInfoObserver);}