Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamtrees #1902

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip - streams only show terminal nodes
  • Loading branch information
jameshadfield committed Nov 14, 2024
commit f28f7260a4996171873d9d9a89acc661b5860f93
10 changes: 7 additions & 3 deletions src/util/partitionIntoStreams.js
Original file line number Diff line number Diff line change
@@ -52,8 +52,8 @@ export function partitionIntoStreams(enabled, nodes, visibility, colorScale, abs

streams.streams = founderIndiciesPostorder.map((founderIdx) => {
const stream = {};
stream.founderIdx = founderIdx;
const nodesInStream = [];
stream.founderIdx = founderIdx; // index of the root node (not part of the stream as it's not a tip)
const nodesInStream = []; // TERMINAL NODES ONLY
const founderNode = nodes[founderIdx];
stream.founderName = founderNode.name;
const stack = [founderNode];
@@ -68,7 +68,11 @@ export function partitionIntoStreams(enabled, nodes, visibility, colorScale, abs
// Note - this double counts this node I think
// TODO - extend the stem of the founder node branch to join with the stream start point.
// if (node.arrayIdx===founderNode.arrayIdx) streams.mask[node.arrayIdx] = 1;
nodesInStream.push(node);

// nodesInStream is terminal only
if (!node.hasChildren) {
nodesInStream.push(node);
}
for (const child of node.children || []) {
stack.push(child)
}