Skip to main content

export_to_dot_with_options

Function export_to_dot_with_options 

Source
pub fn export_to_dot_with_options(
    graph: &EinsumGraph,
    options: &DotExportOptions,
) -> String
Expand description

Export an EinsumGraph to DOT format with custom options.

§Options

  • show_tensor_ids: Show tensor indices in labels
  • show_node_ids: Show node indices in labels
  • show_metadata: Include metadata in node labels
  • cluster_by_operation: Group operations by type
  • horizontal_layout: Use left-to-right layout instead of top-to-bottom

§Example

use tensorlogic_ir::{EinsumGraph, EinsumNode, DotExportOptions, export_to_dot_with_options};

let mut graph = EinsumGraph::new();
let t0 = graph.add_tensor("input".to_string());
let t1 = graph.add_tensor("output".to_string());
let node = EinsumNode::elem_unary("sigmoid", t0, t1);
graph.add_node(node).unwrap();

let options = DotExportOptions {
    show_tensor_ids: true,
    show_node_ids: true,
    horizontal_layout: true,
    ..Default::default()
};

let dot = export_to_dot_with_options(&graph, &options);
assert!(dot.contains("rankdir=LR"));