Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用neo4j和sigma.js的布局_Neo4j_Sigma.js - Fatal编程技术网

使用neo4j和sigma.js的布局

使用neo4j和sigma.js的布局,neo4j,sigma.js,Neo4j,Sigma.js,我正在尝试学习如何将sigma.js与neo4j一起使用,并希望能得到一些帮助,使布局算法与sigma.neo4j.cypher一起使用。与sigma.neo4j.cypher一起使用时,sigma.layout.fruchtermanReingold.js布局在以下代码中不起作用。我很有信心,我有所有的西格玛导入,但如果你觉得问题可能存在,我可以将这些添加到问题中 非常感谢 <div id="container"> <style> #graph-

我正在尝试学习如何将sigma.js与neo4j一起使用,并希望能得到一些帮助,使布局算法与sigma.neo4j.cypher一起使用。与sigma.neo4j.cypher一起使用时,sigma.layout.fruchtermanReingold.js布局在以下代码中不起作用。我很有信心,我有所有的西格玛导入,但如果你觉得问题可能存在,我可以将这些添加到问题中

非常感谢

<div id="container">
    <style>
        #graph-container {
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            position: absolute;
        }
    </style>
    <div id="graph-container"></div>
</div>
<script src="../plugins/sigma.layout.forceAtlas2/worker.js"></script>
<script src="../plugins/sigma.layout.forceAtlas2/supervisor.js"></script>
<script src="../plugins/sigma.plugins.animate/sigma.plugins.animate.js"></script>
<script src="../plugins/sigma.layout.fruchtermanReingold/sigma.layout.fruchtermanReingold.js"></script>
<script type="application/javascript">

    sigma.neo4j.cypher(
            { url: 'http://localhost:7474', user: 'neo4j', password: 'admin' },
            'MATCH (n) OPTIONAL MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 100',
            { container: 'graph-container' } ,
            function(s) {
                console.log('Number of nodes :'+ s.graph.nodes().length);
                console.log('Number of edges :'+ s.graph.edges().length);
            }
    );

    // Configure the Fruchterman-Reingold algorithm:
    var frListener = sigma.layouts.fruchtermanReingold.configure(s, {
      maxIterations: 500,
      easing: 'quadraticInOut',
      duration: 800
    });

    // Bind the events:
    frListener.bind('start stop interpolate', function(e) {
      console.log(e.type);
    });

    // Start the Fruchterman-Reingold algorithm:
    sigma.layouts.fruchtermanReingold.start(s);


</script>

#图形容器{
排名:0;
底部:0;
左:0;
右:0;
位置:绝对位置;
}
sigma.neo4j.cypher(
{url:'http://localhost:7474,用户:'neo4j',密码:'admin'},
'匹配(n)可选匹配(n)-[r]->(m)返回n,r,m限制100',
{container:'graph container'},
职能{
log('节点数:'+s.graph.nodes().length);
console.log('边数:'+s.graph.edges().length);
}
);
//配置Fruchterman Reingold算法:
var frListener=sigma.layouts.fruchtermanReingold.configure{
最大迭代次数:500,
放松:“二次零”,
持续时间:800
});
//绑定事件:
frListener.bind('start-stop interpolate',函数(e){
console.log(e.type);
});
//启动Fruchterman-Reingold算法:
sigma.layouts.fruchtermanReingold.start(s);
Re

我在这里做了一个plunkr演示:

现在,我看到了一张图表,但没有任何进展。。。而fruchtermanReingold示例对链接式回购不起作用


我希望这对您有所帮助

您需要在Cypher插件之外实例化Sigme(如果您不提供它,它将为您实例化sigma对象)。

也许您可以查看linkurious sigma变体以了解一些细节?签出感谢您的建议,但找不到任何东西。这可能是因为cypher插件初始化了sigma实例。我会看一看这个谢谢你罗西玛,让我知道你进展如何。谢谢你非常有用,我会看看我是否能用我自己的例子让它工作。