nodefilter: filter unknown nodes

This commit is contained in:
Milan Pässler 2016-02-28 01:24:04 +01:00
parent 97a00b6925
commit 2e823a90c8

View file

@ -12,10 +12,11 @@ define([], function () {
n.graph = {} n.graph = {}
n.graph.nodes = data.graph.nodes.filter( function (d) { n.graph.nodes = data.graph.nodes.filter( function (d) {
if (!d.node) var r
return true if (d.node)
r = filter(d.node)
var r = filter(d.node) else
r = filter({})
if (r) if (r)
filteredIds.add(d.id) filteredIds.add(d.id)
@ -24,7 +25,7 @@ define([], function () {
}) })
n.graph.links = data.graph.links.filter( function (d) { n.graph.links = data.graph.links.filter( function (d) {
return !d.sourceid || (filteredIds.has(d.source.id) && filteredIds.has(d.target.id)) return filteredIds.has(d.source.id) && filteredIds.has(d.target.id)
}) })
return n return n