Skip to content

Commit

Permalink
Added edge-count preview
Browse files Browse the repository at this point in the history
  • Loading branch information
oskari1 committed Nov 25, 2023
1 parent 62fe0d0 commit 9b55697
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions axiom-profiler-GUI/src/svg_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ impl Component for SVGResult {
.inst_graph
.node_count()
.to_formatted_string(&Locale::en);
let message = format!("Warning: The graph you are about to render contains {} nodes, rendering might be slow. Do you want to proceed?", node_count);
let edge_count = self
.inst_graph
.edge_count()
.to_formatted_string(&Locale::en);
let message = format!("Warning: The graph you are about to render contains {} nodes and {} edges, rendering might be slow. Do you want to proceed?", node_count, edge_count);
let result = window.confirm_with_message(&message);
match result {
Ok(true) => {
Expand Down Expand Up @@ -196,8 +200,8 @@ impl Component for SVGResult {

fn view(&self, ctx: &Context<Self>) -> Html {
let on_node_select = ctx.link().callback(Msg::UpdateSelectedNode);
let node_count_preview = html! {
<h4>{format!{"The filtered graph contains {} nodes", self.inst_graph.node_count()}}</h4>
let node_and_edge_count_preview = html! {
<h4>{format!{"The filtered graph contains {} nodes and {} edges", self.inst_graph.node_count(), self.inst_graph.edge_count()}}</h4>
};
let apply_filter = ctx.link().callback(Msg::ApplyFilter);
let reset_graph = ctx.link().callback(|_| Msg::ResetGraph);
Expand All @@ -215,7 +219,7 @@ impl Component for SVGResult {
dependency={ctx.props().trace_file_text.clone()}
/>
</ContextProvider<Option<InstInfo>>>
{node_count_preview}
{node_and_edge_count_preview}
</div>
<Graph
svg_text={self.svg_text.clone()}
Expand Down
4 changes: 4 additions & 0 deletions smt-log-parser/src/parsers/z3/inst_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ impl InstGraph {
self.inst_graph.node_count()
}

pub fn edge_count(&self) -> usize {
self.inst_graph.edge_count()
}

pub fn get_instantiation_info(&self, node_index: usize, parser: &Z3Parser) -> Option<InstInfo> {
let NodeData { inst_idx, .. } = self
.inst_graph
Expand Down

0 comments on commit 9b55697

Please sign in to comment.