MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / main

Function main

examples/graphs/graph/graph_3.cpp:4–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <matplot/matplot.h>
3
4int main() {
5 using namespace matplot;
6 std::vector<std::pair<size_t, size_t>> edges = {
7 {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 6}, {0, 9}, {1, 5},
8 {1, 6}, {2, 5}, {2, 9}, {3, 7}, {3, 9}, {4, 6}, {4, 7},
9 {5, 8}, {5, 10}, {6, 8}, {7, 8}, {7, 10}, {9, 10}};
10 std::vector<double> weights = {1, 1, 1, 1, 3, 3, 2, 4, 1, 6,
11 2, 8, 8, 9, 3, 2, 10, 12, 15, 16};
12 auto g = graph(edges);
13
14 g->x_data({0, 0.5, -0.5, -0.5, 0.5, 0, 1.5, 0, 2, -1.5, -2});
15 g->y_data({0, 0.5, 0.5, -0.5, -0.5, 2, 0, -2, 0, 0, 0});
16 g->z_data({5, 3, 3, 3, 3, 0, 1, 0, 0, 1, 0});
17
18 g->edge_labels(weights);
19 view(2);
20
21 show();
22 return 0;
23}

Callers

nothing calls this directly

Calls 3

viewFunction · 0.85
showFunction · 0.85
graphFunction · 0.50

Tested by

no test coverage detected