@@ -512,26 +512,27 @@ export class EditorToolsViewComponent {
512512 headers . push ( $localize `:@@app.view.editor-side-view.editor-tools-view-component.connections:Connections` ) ;
513513 headers . push ( $localize `:@@app.view.editor-side-view.editor-tools-view-component.totalCost:Total cost` ) ;
514514
515+ const nodes = this . nodeService . getNodes ( ) ;
515516 const selectedNodes = this . nodeService . getSelectedNodes ( ) ;
516- const nodes = selectedNodes . length > 0 ? selectedNodes : this . nodeService . getVisibleNodes ( ) ;
517+ const odNodes = selectedNodes . length > 0 ? selectedNodes : this . nodeService . getVisibleNodes ( ) ;
517518 const trainruns = this . trainrunService . getVisibleTrainruns ( ) ;
518519
519- const edges = buildEdges ( nodes , trainruns , connectionPenalty , this . trainrunService , timeLimit ) ;
520+ const edges = buildEdges ( nodes , odNodes , trainruns , connectionPenalty , this . trainrunService , timeLimit ) ;
520521
521522 const neighbors = computeNeighbors ( edges ) ;
522523 const vertices = topoSort ( neighbors ) ;
523524 // In theory we could parallelize the pathfindings, but the overhead might be too big.
524525 const res = new Map < string , [ number , number ] > ( ) ;
525- nodes . forEach ( ( origin ) => {
526+ odNodes . forEach ( ( origin ) => {
526527 computeShortestPaths ( origin . getId ( ) , neighbors , vertices ) . forEach ( ( value , key ) => {
527528 res . set ( [ origin . getId ( ) , key ] . join ( "," ) , value ) ;
528529 } ) ;
529530 } ) ;
530531
531532 const rows = [ ] ;
532- nodes . sort ( ( a , b ) => a . getFullName ( ) . localeCompare ( b . getFullName ( ) ) ) ;
533- nodes . forEach ( ( origin ) => {
534- nodes . forEach ( ( destination ) => {
533+ odNodes . sort ( ( a , b ) => a . getFullName ( ) . localeCompare ( b . getFullName ( ) ) ) ;
534+ odNodes . forEach ( ( origin ) => {
535+ odNodes . forEach ( ( destination ) => {
535536 const costs = res . get ( [ origin . getId ( ) , destination . getId ( ) ] . join ( "," ) ) ;
536537 if ( costs === undefined ) {
537538 // Keep empty if no path is found.
0 commit comments