Struct graplot::graph::Graph

source ·
pub struct Graph {
    pub nodes: Vec<Node>,
    pub graph_desc: GraphDesc,
}

Fields§

§nodes: Vec<Node>§graph_desc: GraphDesc

Implementations§

Examples found in repository?
examples/graph.rs (line 4)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fn main() {
    let mut graph = Graph::new();
    graph.graph_desc = GraphDesc {
        node_color: RED,
        outer_ring: (Color::new(1., 0.5, 0.8, 1.), 3.5),
        ..Default::default()
    };
    let a = graph.add_node(vec![]);
    let b = graph.add_node(vec![]);
    let c = graph.add_node(vec![]);
    
    let d = graph.add_node(vec![a.idx, b.idx]);
    let e = graph.add_node(vec![a.idx, c.idx]);

    let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);

    graph.show();
}
More examples
Hide additional examples
examples/graph_modified.rs (line 4)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fn main() {
    let mut graph = Graph::new();
    graph.graph_desc = GraphDesc {
        title: String::from("Graph"),
        node_color: RED,
        egde_color: EdgeColor::Use(MAGENTA),
        ..Default::default()
    };
    let a = graph.add_node(vec![]);
    let b = graph.add_node(vec![]);
    let c = graph.add_node(vec![]);
    
    let d = graph.add_node(vec![a.idx, b.idx]);
    let e = graph.add_node(vec![a.idx, c.idx]);

    let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);

    graph.show();
}
Examples found in repository?
examples/graph.rs (line 10)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fn main() {
    let mut graph = Graph::new();
    graph.graph_desc = GraphDesc {
        node_color: RED,
        outer_ring: (Color::new(1., 0.5, 0.8, 1.), 3.5),
        ..Default::default()
    };
    let a = graph.add_node(vec![]);
    let b = graph.add_node(vec![]);
    let c = graph.add_node(vec![]);
    
    let d = graph.add_node(vec![a.idx, b.idx]);
    let e = graph.add_node(vec![a.idx, c.idx]);

    let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);

    graph.show();
}
More examples
Hide additional examples
examples/graph_modified.rs (line 11)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fn main() {
    let mut graph = Graph::new();
    graph.graph_desc = GraphDesc {
        title: String::from("Graph"),
        node_color: RED,
        egde_color: EdgeColor::Use(MAGENTA),
        ..Default::default()
    };
    let a = graph.add_node(vec![]);
    let b = graph.add_node(vec![]);
    let c = graph.add_node(vec![]);
    
    let d = graph.add_node(vec![a.idx, b.idx]);
    let e = graph.add_node(vec![a.idx, c.idx]);

    let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);

    graph.show();
}
Examples found in repository?
examples/graph.rs (line 19)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fn main() {
    let mut graph = Graph::new();
    graph.graph_desc = GraphDesc {
        node_color: RED,
        outer_ring: (Color::new(1., 0.5, 0.8, 1.), 3.5),
        ..Default::default()
    };
    let a = graph.add_node(vec![]);
    let b = graph.add_node(vec![]);
    let c = graph.add_node(vec![]);
    
    let d = graph.add_node(vec![a.idx, b.idx]);
    let e = graph.add_node(vec![a.idx, c.idx]);

    let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);

    graph.show();
}
More examples
Hide additional examples
examples/graph_modified.rs (line 20)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fn main() {
    let mut graph = Graph::new();
    graph.graph_desc = GraphDesc {
        title: String::from("Graph"),
        node_color: RED,
        egde_color: EdgeColor::Use(MAGENTA),
        ..Default::default()
    };
    let a = graph.add_node(vec![]);
    let b = graph.add_node(vec![]);
    let c = graph.add_node(vec![]);
    
    let d = graph.add_node(vec![a.idx, b.idx]);
    let e = graph.add_node(vec![a.idx, c.idx]);

    let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);

    graph.show();
}

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.