Skip to content

Commit a555c75

Browse files
Show subsumed nodes as grey
1 parent c21f03d commit a555c75

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egraph-visualizer",
3-
"version": "2.0.6",
3+
"version": "2.1.0",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/egraphs-good/egraph-visualizer.git"

src/Visualizer.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,18 @@ export function ENode(
7373
}
7474
>
7575
) {
76+
const subsumed = props?.data?.subsumed || false;
7677
return (
7778
<div
78-
className={`p-1 rounded-md outline bg-white outline-black h-full w-full ${props?.selected ? "outline-2" : "outline-1"}`}
79+
className={`p-1 rounded-md outline bg-white ${subsumed ? "outline-gray-300" : "outline-black"} h-full w-full ${
80+
props?.selected ? "outline-2" : "outline-1"
81+
}`}
7982
ref={props?.outerRef}
8083
>
8184
{props?.outerRef ? <></> : <MyNodeToolbar type="node" id={props!.data!.id} />}
8285

8386
<div
84-
className="font-mono text-xs truncate max-w-96 min-w-4 text-center"
87+
className={`font-mono text-xs truncate max-w-96 min-w-4 text-center ${subsumed ? "text-gray-300" : ""}`}
8588
title={`${props?.data?.id}\n${props?.data?.label}`}
8689
ref={props?.innerRef}
8790
>

src/layout.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type EGraphNode = {
6060
children?: EGraphNodeID[];
6161
eclass: EGraphClassID;
6262
cost: number;
63+
subsumed?: boolean;
6364
};
6465

6566
type EGraphClassData = {
@@ -88,6 +89,7 @@ export type FlowNode = Node<
8889
{
8990
label: string;
9091
id: string;
92+
subsumed?: boolean;
9193
// selected?: boolean
9294
},
9395
"node"
@@ -290,7 +292,7 @@ function toELKNode(
290292
const elkNodeID = `node-${nodeID}`;
291293
const elkNode: MyELKNode["children"][0]["children"][0] = {
292294
id: elkNodeID,
293-
data: { label: node.op, id: nodeID },
295+
data: { label: node.op, id: nodeID, ...(node.subsumed ? { subsumed: true } : {}) },
294296
width: size.width,
295297
height: size.height,
296298
ports: [],

0 commit comments

Comments
 (0)