提交 50b074e2 编写于 作者: J Jason Park

support setTreeData on UndirectedGraph/WeightedUndirectedGraph

上级 00cb9c8c
......@@ -2,7 +2,6 @@ const app = require('../../app');
module.exports = () => {
$(document).on('click', 'a', function (e) {
console.log(e);
e.preventDefault();
if (!window.open($(this).attr('href'), '_blank')) {
alert('Please allow popups for this site');
......
......@@ -75,7 +75,7 @@ class DirectedGraphTracer extends Tracer {
}
}
setTreeData(G, root) {
setTreeData(G, root, undirected) {
var tracer = this;
root = root || 0;
......@@ -92,7 +92,7 @@ class DirectedGraphTracer extends Tracer {
};
getDepth(root, 1);
if (this.setData(G)) return true;
if (this.setData(G, undirected)) return true;
var place = function (node, x, y) {
var temp = tracer.graph.nodes(tracer.n(node));
......@@ -140,14 +140,15 @@ class DirectedGraphTracer extends Tracer {
if (undirected) {
for (let j = 0; j <= i; j++) {
if (G[i][j] || G[j][i]) {
const value = G[i][j] || G[j][i];
if (value) {
edges.push({
id: this.e(i, j),
source: this.n(i),
target: this.n(j),
color: this.color.default,
size: 1,
weight: refineByType(G[i][j])
weight: refineByType(value)
});
}
}
......
......@@ -11,6 +11,10 @@ class UndirectedGraphTracer extends DirectedGraphTracer {
if (this.isNew) initView(this);
}
setTreeData(G, root) {
return super.setTreeData(G, root, true);
}
setData(G) {
return super.setData(G, true);
}
......
......@@ -16,6 +16,10 @@ class WeightedUndirectedGraphTracer extends WeightedDirectedGraphTracer {
if (this.isNew) initView(this);
}
setTreeData(G, root) {
return super.setTreeData(G, root, true);
}
setData(G) {
return super.setData(G, true);
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册