使用sigma.js函数之一连接neo4j

使用sigma.js函数之一连接neo4j,neo4j,sigma.js,Neo4j,Sigma.js,我正在尝试连接sigma.js和neo4j。对于连接,我想使用以下代码: sigma.neo4j.cypher_parse = function(result) { var graph = { nodes: [], edges: [] }, nodesMap = {}, edgesMap = {}, key; ... 但我不知道变量结果的确切含义。如果您尝试cypher插件的内部功能,它很酷 请看一下该方

我正在尝试连接sigma.js和neo4j。对于连接,我想使用以下代码:

sigma.neo4j.cypher_parse = function(result) {
        var graph = { nodes: [], edges: [] },
            nodesMap = {},
            edgesMap = {},
            key; ... 

但我不知道变量结果的确切含义。

如果您尝试cypher插件的内部功能,它很酷

请看一下该方法的JSdoc:

/**
 * This function parse a neo4j cypher query result, and transform it into
 * a sigma graph object.
 *
 * @param  {object}     result      The server response of a cypher query.
 *
 * @return A graph object
 */
所以结果就是neo4j服务器的结果。您可以查看neo4j事务端点:

结果是一个json对象,如下所示:

{
  "results" : [ {
    "columns" : [ "id(n)" ],
    "data" : [ {
      "row" : [ 15 ]
    } ]
  } ],
  "errors" : [ ]
}
但是为什么您不想使用插件的主要功能如下:

mySigmaInstance = new sigma({
  graph: {
      nodes: [],
      edges: []
    },
  container: 'graph-container'
});
sigma.parsers.cypher(
  { url: 'http://localhost:7474', user:'neo4j', password:'admin' },
  'MATCH (n) OPTIONAL MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 100',
  mySigmaInstance,
  function() {
    // Put here your custom code
    // It's the callback function
    mySigmaInstance.refresh();
  }
);