OpenCPU error HTTP 400 Not a graph object

偶尔善良 提交于 2019-12-12 02:44:11

问题


I m using Angularjs and OpenCPU to calculate some data through Igraph R Package

Graph is a adjacency matrix/Array generate by java script

[[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]]

My code is

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));
                    });

                });
          });

        });

showing error

OpenCPU error HTTP 400

Not a graph object

In call:

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)

来源:https://stackoverflow.com/questions/43930580/opencpu-error-http-400-not-a-graph-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!