Microsoft.Research.Naiad.Frameworks.DifferentialDataflow NamespaceNaiad Help

[This is preliminary documentation and is subject to change.]

The Differential Dataflow framework contains extension methods that support LINQ-style incremental and iterative operators.
Classes

  ClassDescription
Public classExtensionMethods
Public classInputCollectionExtensionMethods
Extension methods
Structures

  StructureDescription
Public structureIntPair
An equatable pair of integers
Public structureWeightedTRecord
A record with a signed 64-bit weight, which corresponds to the multiplicity of the record in a multiset.
Interfaces

  InterfaceDescription
Public interfaceCollectionTRecord, TTime
A collection is a multiset of records that varies according to a logical timestamp.
Public interfaceInputCollectionTRecord
Remarks

The Differential Dataflow operators are defined in terms of CollectionTRecord, TTime objects, each of which wraps a Naiad stream and allows it to be interpreted with multiset semantics. The InputCollectionTRecord class is the Differential Dataflow–specific wrapper for the Naiad BatchedDataSourceTRecord class.
Examples

A simple Differential Dataflow program can be written as follows:
using Microsoft.Research.Naiad;
using Microsoft.Research.Naiad.Frameworks.DifferentialDataflow;

class Program
{
    public static void Main(string[] args)
    {
        using (Controller controller = NewController.FromArgs(ref args)
        {
            using (Computation computation = controller.NewComputation())
            {
                // Define a computation in terms of collections.
                InputCollection<int> input = computation.NewInputCollection();

                var histogram = input.Count(x => x);

                // A subscription collects the result of the computation, and applies
                // an action to the array of weighted updates.
                Subscription subscription = histogram.Subscribe(changes => { /* ... */ });

                computation.Activate();

                // The OnNext() method takes an IEnumerable<int> that specifies records to add.
                input.OnNext(new int[] { 1, 1, 2, 3, 5, 8 });
                input.Sync(0); 

                input.OnNext(new int[] { 13 });
                input.Sync(1);

                // This OnNext() overload allows elements to be added with integer weights.
                // The weights may be positive (adding records) or negative (removing records).
                input.OnNext(new Weighted<int>[] { new Weighted<int>(1, -2) });
                input.Sync(2);

                computation.Join();
            }

            controller.Join();
        }

    }
}
See Also

Reference