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