Rhizi / rhizi

Connective intelligence
GNU Affero General Public License v3.0
14 stars 3 forks source link

slowness )1 minute import time) when doing an import of 1000 nodes #680

Open alon opened 8 years ago

alon commented 8 years ago

Create the following json (with n=1000) and then import it (append '?debug=1' to url)

python make_large_graph.py -n 1000 > line1000.json

make_large_graph.py:

#!/usr/bin/env python

import sys
import json
import argparse

type_person = 'person'
type_project = 'project'

make_id = lambda i: 'large-{}'.format(i)

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-n', type=int, default=100)
    args = parser.parse_args(sys.argv[1:])
    N = args.n
    data = {
        "nodes":
            [
                {
                    "id": make_id(i),
                    "x": 500 + i * 200.0 / N,
                    "y": 500,
                    "name": make_id(i),
                    "status":"unknown",
                    "type": type_person
                 }
                for i in range(N)
            ],
        "links":
        [
            {
                "__src": make_id(i),
                "__dst": make_id((i + 1) % N),
                "name": 'link-{}-{}'.format(i, (i + 1) % N)
            }
            for i in range(N)
        ]
    }
    print(json.dumps(data))

if __name__ == '__main__':
    main()