pub struct Dot<'a, G>where
G: IntoEdgeReferences + IntoNodeReferences,{ /* private fields */ }
Expand description
Dot
implements output to graphviz .dot format for a graph.
Formatting and options are rather simple, this is mostly intended for debugging. Exact output may change.
Examples
use petgraph::Graph;
use petgraph::dot::{Dot, Config};
let mut graph = Graph::<_, ()>::new();
graph.add_node("A");
graph.add_node("B");
graph.add_node("C");
graph.add_node("D");
graph.extend_with_edges(&[
(0, 1), (0, 2), (0, 3),
(1, 2), (1, 3),
(2, 3),
]);
println!("{:?}", Dot::with_config(&graph, &[Config::EdgeNoLabel]));
// In this case the output looks like this:
//
// digraph {
// 0 [label="\"A\""]
// 1 [label="\"B\""]
// 2 [label="\"C\""]
// 3 [label="\"D\""]
// 0 -> 1
// 0 -> 2
// 0 -> 3
// 1 -> 2
// 1 -> 3
// 2 -> 3
// }
// If you need multiple config options, just list them all in the slice.
Implementations§
source§impl<'a, G> Dot<'a, G>where
G: IntoNodeReferences + IntoEdgeReferences,
impl<'a, G> Dot<'a, G>where
G: IntoNodeReferences + IntoEdgeReferences,
sourcepub fn with_config(graph: G, config: &'a [Config]) -> Dot<'a, G>
pub fn with_config(graph: G, config: &'a [Config]) -> Dot<'a, G>
Create a Dot
formatting wrapper with custom configuration.
pub fn with_attr_getters( graph: G, config: &'a [Config], get_edge_attributes: &'a dyn Fn(G, <G as IntoEdgeReferences>::EdgeRef) -> String, get_node_attributes: &'a dyn Fn(G, <G as IntoNodeReferences>::NodeRef) -> String ) -> Dot<'a, G>
Trait Implementations§
source§impl<'a, G> Debug for Dot<'a, G>where
G: IntoEdgeReferences + IntoNodeReferences + NodeIndexable + GraphProp,
<G as Data>::EdgeWeight: Debug,
<G as Data>::NodeWeight: Debug,
impl<'a, G> Debug for Dot<'a, G>where
G: IntoEdgeReferences + IntoNodeReferences + NodeIndexable + GraphProp,
<G as Data>::EdgeWeight: Debug,
<G as Data>::NodeWeight: Debug,
source§impl<'a, G> Display for Dot<'a, G>where
G: IntoEdgeReferences + IntoNodeReferences + NodeIndexable + GraphProp,
<G as Data>::EdgeWeight: Display,
<G as Data>::NodeWeight: Display,
impl<'a, G> Display for Dot<'a, G>where
G: IntoEdgeReferences + IntoNodeReferences + NodeIndexable + GraphProp,
<G as Data>::EdgeWeight: Display,
<G as Data>::NodeWeight: Display,
Auto Trait Implementations§
impl<'a, G> !RefUnwindSafe for Dot<'a, G>
impl<'a, G> !Send for Dot<'a, G>
impl<'a, G> !Sync for Dot<'a, G>
impl<'a, G> Unpin for Dot<'a, G>where
G: Unpin,
impl<'a, G> !UnwindSafe for Dot<'a, G>
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
Return the
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.