class RootedGraphKernelDynamicProgramming : public RootedGraphKernel
{
public:
    void SetParameters(UINT pathLength, UINT maxPathLength, const NodeKernel &nodeKernel, const EdgeKernel &edgeKernel);
    void SetGraphs(const Graph &g0, const Graph &g1);
    double Evaluate(const Node &n0, const Node &n1) const;

private:
    void UpdateTable() const;

    //
    // Parameters
    //
    UINT _maxPathLength;
    UINT _pathLength;
    const NodeKernel *_nodeKernel;
    const EdgeKernel *_edgeKernel;
    const Graph *_g0, *_g1;

    //
    // Table
    //
    __forceinline double GetTableValue(int n0Index, int n1Index, int p) const
    {
        return _table(n0Index, n1Index)[p];
    }
    __forceinline void SetTableValue(int n0Index, int n1Index, int p, double value)
    {
        _table(n0Index, n1Index)[p] = value;
    }
    mutable Grid< Vector<double> > _table;
    mutable bool _tableDirty;
};