protected override void OnEdgeUpdate ( Node from, Node to ) { lock ( cycleLock ) { var cycles = CycleMap[from, to]; if ( cycles is null ) return; foreach ( var cycle in cycles ) if ( cycle.UpdateWeight ( ) < 0 ) NegativeCycleFound?.Invoke ( this, cycle ); } }
protected override void OnEdgeInsert ( Node from, Node to ) { lock ( cycleLock ) { var cycles = ( from, to ).GetTriangularCycles ( ).ToList ( ); allCycles.UnionWith ( cycles ); UpdateCycleMap ( cycles ); foreach ( var cycle in cycles ) if ( cycle.UpdateWeight ( ) < 0 ) NegativeCycleFound?.Invoke ( this, cycle ); } }