C5 — Print a graph

C5 — Print a graph#

Turn any eagle graph into a picture: the same layout and renderers draw a C++ cpu::Graph and a Python eagle.Graph.

Time: ~2 min · Runs on: CPU (pure C++, no CUDA) · You need: C2

    const eagle::graph::Description d = eagle::graph::describe(g);
    const eagle::graph::Layout lay    = eagle::graph::layout(d);
    std::cout << eagle::graph::ascii(d, lay);
  stage 0        ┌─────────┐
                 │ native0 │
                 └────┬────┘
                      │
               ┌──────┴──────┐
  stage 1 ┌────┴────┐   ┌────┴────┐
          │ native1 │   │ native2 │
          └────┬────┘   └────┬────┘
               │             │
               └──────┬──────┘
  stage 2        ┌────┴────┐
                 │ native3 │
                 └─────────┘
flowchart TD
  n0["native0"]
  n1["native1"]
  n2["native2"]
  n3["native3"]
  n0 --> n1
  n0 --> n2
  n1 --> n3
  n2 --> n3

describe read the four nodes and their dependencies; layout put the two siblings on one stage; ascii drew the boxes. The full story, including Mermaid, DOT and finding edges from raw memory ranges, is Seeing a graph from C++: eagle/graph.