diff --git a/axiom-profiler-GUI/src/results/graph/graph.rs b/axiom-profiler-GUI/src/results/graph/graph.rs index ac165e03..76b6bc9d 100644 --- a/axiom-profiler-GUI/src/results/graph/graph.rs +++ b/axiom-profiler-GUI/src/results/graph/graph.rs @@ -5,6 +5,8 @@ use yew::prelude::*; use yew::{function_component, html, use_node_ref, Html}; use petgraph::graph::NodeIndex; +const NODE_SHAPE: &str = "polygon"; + #[derive(Properties, PartialEq, Default)] pub struct GraphProps { pub svg_text: AttrValue, @@ -73,7 +75,7 @@ pub fn graph(props: &GraphProps) -> Html { for i in 0..nodes.length() { let node = nodes.item(i).unwrap(); let ellipse = node - .query_selector("ellipse") + .query_selector(NODE_SHAPE) .expect("Failed to select ellipse") .unwrap(); let _ = ellipse.set_attribute("stroke-width", "1"); @@ -106,7 +108,7 @@ pub fn graph(props: &GraphProps) -> Html { // extract node_index from node to construct callback that emits it let node = descendant_nodes.item(i).unwrap(); let ellipse = node - .query_selector("ellipse") + .query_selector(NODE_SHAPE) .expect("Failed to select title element") .unwrap(); let node_index = node.id().strip_prefix("node").unwrap().parse::().unwrap(); @@ -231,7 +233,7 @@ pub fn graph(props: &GraphProps) -> Html { let node = nodes.item(i).unwrap(); let node_index = NodeIndex::new(node.id().strip_prefix("node").unwrap().parse::().unwrap()); let ellipse = node - .query_selector("ellipse") + .query_selector(NODE_SHAPE) .expect("Failed to select ellipse") .unwrap(); if selected_nodes.contains(&node_index) { @@ -253,7 +255,7 @@ pub fn graph(props: &GraphProps) -> Html { for i in 0..nodes.length() { let node = nodes.item(i).unwrap(); let ellipse = node - .query_selector("ellipse") + .query_selector(NODE_SHAPE) .expect("Failed to select ellipse") .unwrap(); let _ = ellipse.set_attribute("stroke-width", "1"); diff --git a/axiom-profiler-GUI/src/results/svg_result.rs b/axiom-profiler-GUI/src/results/svg_result.rs index 840db6eb..3dd7479c 100644 --- a/axiom-profiler-GUI/src/results/svg_result.rs +++ b/axiom-profiler-GUI/src/results/svg_result.rs @@ -188,16 +188,24 @@ impl Component for SVGResult { } ), &|_, (_, node_data)| { - format!("id={} label=\"{}\" style=filled shape=oval fillcolor=\"{}\" fontcolor=black gradientangle=90", + format!("id={} label=\"{}\" style=filled shape={} fillcolor=\"{}\" fontcolor=black gradientangle=90", format!("node{}", node_data.orig_graph_idx.index()), node_data.orig_graph_idx.index(), + // match (self.inst_graph.node_has_filtered_children(node_data.orig_graph_idx), + // self.inst_graph.node_has_filtered_parents(node_data.orig_graph_idx)) { + // (false, false) => format!("{}", self.colour_map.get(&node_data.quant_idx, 0.7)), + // (false, true) => format!("{}:{}", self.colour_map.get(&node_data.quant_idx, 1.0), self.colour_map.get(&node_data.quant_idx, 0.1)), + // (true, false) => format!("{}:{}", self.colour_map.get(&node_data.quant_idx, 0.1), self.colour_map.get(&node_data.quant_idx, 1.0)), + // (true, true) => format!("{}", self.colour_map.get(&node_data.quant_idx, 0.3)), + // }, match (self.inst_graph.node_has_filtered_children(node_data.orig_graph_idx), self.inst_graph.node_has_filtered_parents(node_data.orig_graph_idx)) { - (false, false) => format!("{}", self.colour_map.get(&node_data.quant_idx, 0.7)), - (false, true) => format!("{}:{}", self.colour_map.get(&node_data.quant_idx, 1.0), self.colour_map.get(&node_data.quant_idx, 0.1)), - (true, false) => format!("{}:{}", self.colour_map.get(&node_data.quant_idx, 0.1), self.colour_map.get(&node_data.quant_idx, 1.0)), - (true, true) => format!("{}", self.colour_map.get(&node_data.quant_idx, 0.3)), + (false, false) => "box", + (false, true) => "house", + (true, false) => "invhouse", + (true, true) => "diamond", }, + self.colour_map.get(&node_data.quant_idx, 0.4), ) }, ) diff --git a/smt-log-parser/src/items.rs b/smt-log-parser/src/items.rs index 04be86cd..37dbaeb1 100644 --- a/smt-log-parser/src/items.rs +++ b/smt-log-parser/src/items.rs @@ -75,7 +75,13 @@ impl Term { let kind = match self.kind { TermKind::Var(qvar) if ctxt.quant.is_some() => { match ctxt.quant.unwrap().vars.as_ref().unwrap() { - VarNames::NameAndType(vars) => vars[qvar].0.clone(), + VarNames::NameAndType(vars) => { + if let Some(var_name) = vars.get(qvar) { + var_name.0.clone() + } else { + format!("{}", self.kind) + } + }, _ => format!("{}", self.kind), } },