Esempio n. 1
0
		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 );
			}
		}
Esempio n. 2
0
		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 );
			}
		}