@@ -919,56 +919,4 @@ export class WorkflowActionService {
919919 public getHighlightingEnabled ( ) {
920920 return this . highlightingEnabled ;
921921 }
922-
923- /**
924- * Find all operators and links on any upstream path leading to the given destination operator.
925- * Uses BFS to traverse backwards from the destination to find all contributing operators.
926- * @param destinationOperatorId The operator ID to find upstream paths to
927- * @returns Object containing arrays of operator IDs and link IDs on upstream paths
928- */
929- public findUpstreamPath ( destinationOperatorId : string ) : { operators : string [ ] ; links : string [ ] } {
930- const allLinks = this . getTexeraGraph ( ) . getAllLinks ( ) ;
931-
932- // Build reverse adjacency list (from target to source)
933- const reverseAdjacencyMap = new Map < string , Array < { neighbor : string ; linkId : string } > > ( ) ;
934- allLinks . forEach ( link => {
935- const source = link . source . operatorID ;
936- const target = link . target . operatorID ;
937- if ( ! reverseAdjacencyMap . has ( target ) ) {
938- reverseAdjacencyMap . set ( target , [ ] ) ;
939- }
940- reverseAdjacencyMap . get ( target ) ! . push ( { neighbor : source , linkId : link . linkID } ) ;
941- } ) ;
942-
943- // BFS to find all upstream operators and links
944- const queue : string [ ] = [ destinationOperatorId ] ;
945- const visitedOperators = new Set < string > ( ) ;
946- const allOperatorsOnPaths = new Set < string > ( ) ;
947- const allLinksOnPaths = new Set < string > ( ) ;
948-
949- allOperatorsOnPaths . add ( destinationOperatorId ) ; // Include the destination operator
950-
951- while ( queue . length > 0 ) {
952- const current = queue . shift ( ) ! ;
953-
954- if ( visitedOperators . has ( current ) ) {
955- continue ;
956- }
957- visitedOperators . add ( current ) ;
958-
959- const upstreamNeighbors = reverseAdjacencyMap . get ( current ) || [ ] ;
960- for ( const { neighbor, linkId } of upstreamNeighbors ) {
961- allOperatorsOnPaths . add ( neighbor ) ;
962- allLinksOnPaths . add ( linkId ) ;
963- if ( ! visitedOperators . has ( neighbor ) ) {
964- queue . push ( neighbor ) ;
965- }
966- }
967- }
968-
969- return {
970- operators : Array . from ( allOperatorsOnPaths ) ,
971- links : Array . from ( allLinksOnPaths ) ,
972- } ;
973- }
974922}
0 commit comments