Skip to content

Commit

Permalink
dashed intergraph edges in dotstring
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Apr 26, 2023
1 parent 258fa06 commit 5c56807
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/hugr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::rewrite::{Rewrite, RewriteError};
pub use validate::ValidationError;
mod hugrmut;
pub mod serialize;
pub use hugrmut::{BuildError, HugrMut};
pub use hugrmut::HugrMut;

/// The Hugr data structure.
#[derive(Clone, Debug, PartialEq)]
Expand Down Expand Up @@ -121,7 +121,21 @@ impl Hugr {
ni = n.index()
)
},
|_| ("".into(), DotEdgeStyle::None),
|p| {
("".into(), {
let src = self.graph.port_node(p).unwrap();
let tgt = self
.graph
.port_node(self.graph.port_link(p).unwrap())
.unwrap();

if self.hierarchy.parent(src) != self.hierarchy.parent(tgt) {
DotEdgeStyle::Some("dashed".into())
} else {
DotEdgeStyle::None
}
})
},
)
}

Expand Down

0 comments on commit 5c56807

Please sign in to comment.