function migrate_config() {
        var old_version = config_.config_version || 0;
        if(old_version === CONFIG_VERSION)
            return false;
        // upgrade from version M to N
        var migration_graph = {
            '0': {
                '1': function(config) {
                    // star all notebooks in interests
                    for(var u in config.interests)
                        for(var n in config.interests[u])
                            rcloud.stars.star_notebook(n);
                }
            }
        };
        function find_path(a, b) {
            if(a === b)
                return [];
            var links = migration_graph[a];
            if(!links)
                return null;
            if(links[b])
                return [{version: b, f: links[b]}];
            var path;
            for(var l in links)
                if((path = find_path(l, b))) {
                    path.unshift({version: l, f: links[l]});
                    return path;
                }
            return null;
        }
        var migration_path = find_path(old_version, CONFIG_VERSION);
        for(var i = 0; i < migration_path.length; ++i)
            migration_path[i].f(config_);
        config_.config_version = CONFIG_VERSION;
        return true;
    }
// obviously results will be unpredictable if there is more than one path.
obviously results will be unpredictable if there is more than one path.
obviously results will be unpredictable if there is more than one path .
function migrate_config() {
        var old_version = config_.config_version || 0;
        if(old_version === CONFIG_VERSION)
            return false;
        var migration_graph = {
            '0': {
                '1': function(config) {
                    for(var u in config.interests)
                        for(var n in config.interests[u])
                            rcloud.stars.star_notebook(n);
                }
            }
        };
        function find_path(a, b) {
            if(a === b)
                return [];
            var links = migration_graph[a];
            if(!links)
                return null;
            if(links[b])
                return [{version: b, f: links[b]}];
            var path;
            for(var l in links)
                if((path = find_path(l, b))) {
                    path.unshift({version: l, f: links[l]});
                    return path;
                }
            return null;
        }
        var migration_path = find_path(old_version, CONFIG_VERSION);
        for(var i = 0; i < migration_path.length; ++i)
            migration_path[i].f(config_);
        config_.config_version = CONFIG_VERSION;
        return true;
    }
function migrate_config ( ) { var old_version = config_ . config_version || 0 ; if ( old_version === CONFIG_VERSION ) return false ; var migration_graph = { '0' : { '1' : function ( config ) { for ( var u in config . interests ) for ( var n in config . interests [ u ] ) rcloud . stars . star_notebook ( n ) ; } } } ; function find_path ( a , b ) { if ( a === b ) return [ ] ; var links = migration_graph [ a ] ; if ( ! links ) return null ; if ( links [ b ] ) return [ { version : b , f : links [ b ] } ] ; var path ; for ( var l in links ) if ( ( path = find_path ( l , b ) ) ) { path . unshift ( { version : l , f : links [ l ] } ) ; return path ; } return null ; } var migration_path = find_path ( old_version , CONFIG_VERSION ) ; for ( var i = 0 ; i < migration_path . length ; ++ i ) migration_path [ i ] . f ( config_ ) ; config_ . config_version = CONFIG_VERSION ; return true ; }
obviously results will be unpredictable if there is more than one path.
obviously results will be unpredictable if there is more than one path .
// upgrade from version M to N // star all notebooks in interests