OpenCPU错误HTTP 400不是图形对象

时间:2017-05-12 06:18:10

标签: angularjs r igraph opencpu

我使用Angularjs和OpenCPU通过Igraph R Package计算一些数据

Graph是由java脚本生成的邻接矩阵/数组

[[0,1,1,0,1,1,0,0,0,1,1,1,1,1],[1,0,1,1,1,1,1,1,1,1,0,1,1,1],[1,1,0,1,0,1,1,1,1,1,1,1,1,1],[0,1,1,0,1,0,0,0,0,1,0,1,0,0],[1,1,0,1,0,1,0,0,0,1,1,0,1,0],[1,1,1,0,1,0,0,1,0,1,1,1,1,1],[0,1,1,0,0,0,0,1,0,0,1,1,1,1],[0,1,1,0,0,1,1,1,1,1,0,1,0,1],[0,1,1,0,0,0,0,1,0,1,1,0,0,0],[1,1,1,1,1,1,0,1,1,0,0,0,0,1],[1,0,1,0,1,1,1,0,1,0,0,0,1,1],[1,1,1,1,0,1,1,1,0,0,0,0,1,1],[1,1,1,0,1,1,1,0,0,0,1,1,0,0],[1,1,1,0,0,1,1,1,0,1,1,1,0,0]]

我的代码是

ocpu.call("graph_from_adjacency_matrix", {adjmatrix: graph, mode:'directed', weighted:true}, function(res){

            console.log(res);


            $http.get("//public.opencpu.org/"+res.output[0]+"/print").success(function(res1) {

                ocpu.call("centralization.closeness", {graph:res1, mode:"all", normalized:true}, function(res2){

                    res2.getObject(function(data){
                        //data is the object returned by the R function
                        alert("Array of length " + data.length + ".\nFirst few values:" + data.slice(0,3));
                    });

                });
          });

        });

显示错误

OpenCPU error HTTP 400

不是图表对象

致电:

centralization.closeness(graph = "IGRAPH D-W- 14 119 -- \n+ attr: weight (e/n)\n+ edges:\n [1]  1-> 2  1-> 3  1-> 5  1-> 6  1->10  1->11  1->12  1->13  1->14  2-> 1\n[11]  2-> 3  2-> 4  2-> 5  2-> 6  2-> 7  2-> 8  2-> 9  2->10  2->12  2->13\n[21]  2->14  3-> 1  3-> 2  3-> 4  3-> 6  3-> 7  3-> 8  3-> 9  3->10  3->11\n[31]  3->12  3->13  3->14  4-> 2  4-> 3  4-> 5  4->10  4->12  5-> 1  5-> 2\n[41]  5-> 4  5-> 6  5->10  5->11  5->13  6-> 1  6-> 2  6-> 3  6-> 5  6-> 8\n[51]  6->10  6->11  6->12  6->13  6->14  7-> 2  7-> 3  7-> 8  7->11  7->12\n[61]  7->13  7->14  8-> 2  8-> 3  8-> 6  8-> 7  8-> 8  8-> 9  8->10  8->12\n[71]  8->14  9-> 2  9-> 3  9-> 8  9->10  9->11 10-> 1 10-> 2 10-> 3 10-> 4\n+ ... omitted several edges\n", 
mode = "all", normalized = TRUE)

0 个答案:

没有答案