pub struct Graph {
pub nodes: Vec<Node>,
pub graph_desc: GraphDesc,
}
Fields§
§nodes: Vec<Node>
§graph_desc: GraphDesc
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn new() -> Graph
pub fn new() -> Graph
Examples found in repository?
examples/graph.rs (line 4)
3fn main() {
4 let mut graph = Graph::new();
5 graph.graph_desc = GraphDesc {
6 node_color: RED,
7 outer_ring: (Color::new(1., 0.5, 0.8, 1.), 3.5),
8 ..Default::default()
9 };
10 let a = graph.add_node(vec![]);
11 let b = graph.add_node(vec![]);
12 let c = graph.add_node(vec![]);
13
14 let d = graph.add_node(vec![a.idx, b.idx]);
15 let e = graph.add_node(vec![a.idx, c.idx]);
16
17 let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);
18
19 graph.show();
20}
More examples
examples/graph_modified.rs (line 4)
3fn main() {
4 let mut graph = Graph::new();
5 graph.graph_desc = GraphDesc {
6 title: String::from("Graph"),
7 node_color: RED,
8 egde_color: EdgeColor::Use(MAGENTA),
9 ..Default::default()
10 };
11 let a = graph.add_node(vec![]);
12 let b = graph.add_node(vec![]);
13 let c = graph.add_node(vec![]);
14
15 let d = graph.add_node(vec![a.idx, b.idx]);
16 let e = graph.add_node(vec![a.idx, c.idx]);
17
18 let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);
19
20 graph.show();
21}
pub fn set_graph_desc(&mut self, graph_desc: GraphDesc)
Sourcepub fn add_node(&mut self, deps: Vec<usize>) -> Node
pub fn add_node(&mut self, deps: Vec<usize>) -> Node
Examples found in repository?
examples/graph.rs (line 10)
3fn main() {
4 let mut graph = Graph::new();
5 graph.graph_desc = GraphDesc {
6 node_color: RED,
7 outer_ring: (Color::new(1., 0.5, 0.8, 1.), 3.5),
8 ..Default::default()
9 };
10 let a = graph.add_node(vec![]);
11 let b = graph.add_node(vec![]);
12 let c = graph.add_node(vec![]);
13
14 let d = graph.add_node(vec![a.idx, b.idx]);
15 let e = graph.add_node(vec![a.idx, c.idx]);
16
17 let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);
18
19 graph.show();
20}
More examples
examples/graph_modified.rs (line 11)
3fn main() {
4 let mut graph = Graph::new();
5 graph.graph_desc = GraphDesc {
6 title: String::from("Graph"),
7 node_color: RED,
8 egde_color: EdgeColor::Use(MAGENTA),
9 ..Default::default()
10 };
11 let a = graph.add_node(vec![]);
12 let b = graph.add_node(vec![]);
13 let c = graph.add_node(vec![]);
14
15 let d = graph.add_node(vec![a.idx, b.idx]);
16 let e = graph.add_node(vec![a.idx, c.idx]);
17
18 let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);
19
20 graph.show();
21}
pub fn set_node_color(&mut self, node_color: Color)
pub fn layers(&self) -> Vec<Layer<'_>>
Sourcepub fn show(self)
pub fn show(self)
Examples found in repository?
examples/graph.rs (line 19)
3fn main() {
4 let mut graph = Graph::new();
5 graph.graph_desc = GraphDesc {
6 node_color: RED,
7 outer_ring: (Color::new(1., 0.5, 0.8, 1.), 3.5),
8 ..Default::default()
9 };
10 let a = graph.add_node(vec![]);
11 let b = graph.add_node(vec![]);
12 let c = graph.add_node(vec![]);
13
14 let d = graph.add_node(vec![a.idx, b.idx]);
15 let e = graph.add_node(vec![a.idx, c.idx]);
16
17 let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);
18
19 graph.show();
20}
More examples
examples/graph_modified.rs (line 20)
3fn main() {
4 let mut graph = Graph::new();
5 graph.graph_desc = GraphDesc {
6 title: String::from("Graph"),
7 node_color: RED,
8 egde_color: EdgeColor::Use(MAGENTA),
9 ..Default::default()
10 };
11 let a = graph.add_node(vec![]);
12 let b = graph.add_node(vec![]);
13 let c = graph.add_node(vec![]);
14
15 let d = graph.add_node(vec![a.idx, b.idx]);
16 let e = graph.add_node(vec![a.idx, c.idx]);
17
18 let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);
19
20 graph.show();
21}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnwindSafe for Graph
Blanket Implementations§
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