M: Small graph fixes
Some checks are pending
Frontend CI / build (22.x) (push) Waiting to run

This commit is contained in:
Ivan 2024-08-28 16:50:14 +03:00
parent 2fb64ef69a
commit cf3c9debc8
2 changed files with 12 additions and 12 deletions

View File

@ -241,27 +241,27 @@ export class Graph {
topologicalOrder(): number[] { topologicalOrder(): number[] {
const result: number[] = []; const result: number[] = [];
const marked = new Map<number, boolean>(); const marked = new Set<number>();
const toVisit: number[] = []; const nodeStack: number[] = [];
this.nodes.forEach(node => { this.nodes.forEach(node => {
if (marked.get(node.id)) { if (marked.has(node.id)) {
return; return;
} }
toVisit.push(node.id); nodeStack.push(node.id);
while (toVisit.length > 0) { while (nodeStack.length > 0) {
const item = toVisit[toVisit.length - 1]; const item = nodeStack[nodeStack.length - 1];
if (marked.get(item)) { if (marked.has(item)) {
if (!result.find(id => id === item)) { if (!result.find(id => id === item)) {
result.push(item); result.push(item);
} }
toVisit.pop(); nodeStack.pop();
} else { } else {
marked.set(item, true); marked.add(item);
const itemNode = this.nodes.get(item); const itemNode = this.nodes.get(item);
if (itemNode && itemNode.outputs.length > 0) { if (itemNode && itemNode.outputs.length > 0) {
itemNode.outputs.forEach(child => { itemNode.outputs.forEach(child => {
if (!marked.get(child)) { if (!marked.has(child)) {
toVisit.push(child); nodeStack.push(child);
} }
}); });
} }

View File

@ -28,7 +28,7 @@ export const PARAMETER = {
typificationTruncate: 42, // characters - threshold for long typification - truncate typificationTruncate: 42, // characters - threshold for long typification - truncate
ossLongLabel: 14, // characters - threshold for long labels - small font ossLongLabel: 14, // characters - threshold for long labels - small font
ossTruncateLabel: 28, // characters - threshold for long labels - truncate ossTruncateLabel: 32, // characters - threshold for long labels - truncate
statSmallThreshold: 3, // characters - threshold for small labels - small font statSmallThreshold: 3, // characters - threshold for small labels - small font