def filter(): ## canciones[between]=0,20&sexo[equal]=mujer filters = parse_filters(request.args.items()) gph = Graph() people, friendships = friend.filter(filters) statistics = GraphStatistics(gph, people) for k, p in people.iteritems(): gph.add_node(p, 'usuario') for f in friendships: gph.add_edge([f['usuario_1'], f['usuario_2']], songs=f['canciones']) st = statistics.compute() return jsonify({ 'statistics': st, 'nodes': gph.nodes, 'edges': gph.edges })