From 800e492d89a4d4cc254f505b98e1403986959a04 Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Wed, 28 Aug 2024 16:50:01 +0300 Subject: [PATCH] M: Small graph fixes --- rsconcept/frontend/src/models/Graph.ts | 22 +++++++++++----------- rsconcept/frontend/src/utils/constants.ts | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rsconcept/frontend/src/models/Graph.ts b/rsconcept/frontend/src/models/Graph.ts index 8d44d090..68383181 100644 --- a/rsconcept/frontend/src/models/Graph.ts +++ b/rsconcept/frontend/src/models/Graph.ts @@ -241,27 +241,27 @@ export class Graph { topologicalOrder(): number[] { const result: number[] = []; - const marked = new Map(); - const toVisit: number[] = []; + const marked = new Set(); + const nodeStack: number[] = []; this.nodes.forEach(node => { - if (marked.get(node.id)) { + if (marked.has(node.id)) { return; } - toVisit.push(node.id); - while (toVisit.length > 0) { - const item = toVisit[toVisit.length - 1]; - if (marked.get(item)) { + nodeStack.push(node.id); + while (nodeStack.length > 0) { + const item = nodeStack[nodeStack.length - 1]; + if (marked.has(item)) { if (!result.find(id => id === item)) { result.push(item); } - toVisit.pop(); + nodeStack.pop(); } else { - marked.set(item, true); + marked.add(item); const itemNode = this.nodes.get(item); if (itemNode && itemNode.outputs.length > 0) { itemNode.outputs.forEach(child => { - if (!marked.get(child)) { - toVisit.push(child); + if (!marked.has(child)) { + nodeStack.push(child); } }); } diff --git a/rsconcept/frontend/src/utils/constants.ts b/rsconcept/frontend/src/utils/constants.ts index 08400d9c..791b66e5 100644 --- a/rsconcept/frontend/src/utils/constants.ts +++ b/rsconcept/frontend/src/utils/constants.ts @@ -28,7 +28,7 @@ export const PARAMETER = { typificationTruncate: 42, // characters - threshold for long typification - truncate 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