| | |
| | | while (depth >= 0 && wl.length > 0) { |
| | | // compute neighbours |
| | | const cur = wl.shift() |
| | | console.log(depth, cur, wl) |
| | | if (cur === "__SENTINEL") { |
| | | depth-- |
| | | wl.push("__SENTINEL") |
| | |
| | | neighbours.add(cur) |
| | | const outgoing = index.links[cur] || [] |
| | | const incoming = index.backlinks[cur] || [] |
| | | console.log(incoming) |
| | | wl.push(...outgoing.map(l => l.target), ...incoming.map(l => l.source)) |
| | | } |
| | | } |
| | |
| | | .attr("fill", color) |
| | | .style("cursor", "pointer") |
| | | .on("click", (_, d) => { |
| | | window.location.href = {{.Site.BaseURL}} + d.id.replace(" ", "-").replace("%20", "-"); |
| | | window.location.href = {{.Site.BaseURL}} + decodeURI(d.id).replace(/[\s_]+/g, '-') |
| | | }) |
| | | .on("mouseover", function (_, d) { |
| | | d3.selectAll(".node") |
| | |
| | | const labels = graphNode.append("text") |
| | | .attr("dx", 12) |
| | | .attr("dy", ".35em") |
| | | .text((d) => content[d.id.replace("%20", "-")]?.title || "Untitled") |
| | | .text((d) => content[decodeURI(d.id).replace(/[\s_]+/g, '-')]?.title || "Untitled") |
| | | .style("opacity", 0) |
| | | .style("pointer-events", "none") |
| | | .call(drag(simulation)); |