holzschu / Carnets

Carnets is a stand-alone Jupyter notebook server and client. Edit your notebooks on the go, even where there is no network.
https://holzschu.github.io/Carnets_Jupyter/
BSD 3-Clause "New" or "Revised" License
546 stars 31 forks source link

Graphviz #164

Open hoiyuenhk opened 3 years ago

hoiyuenhk commented 3 years ago

I have created a little graphviz program to draw tree diagrams for secondary school students. It runs on my Mac with Jupiter Notebook. However it does not run in Carnets. `

l = [['italian', 'japanese', 'cantonese'], ['menu A', 'menu B']]

def treeDiagram(d, l): a = ['x'] b = [1] k = 1 for i in range(len(l)): b.append(len(l[i])) for j in range(b[-1]k): a.append(l[i][j % b[-1]]) k = kb[-1] for i in range(len(a)): d.node(str(i),a[i]) p = 0 q = 1

for i in range(len(b)-1):
    t = 1
    r = [(t:=t*v) for v in b][i]
    for k in range(r):
        for s in range(b[i+1]):
            d.edge(str(p),str(q))
            q += 1
        p += 1

dot = Digraph() treeDiagram(dot,[['A', 'B'], ['C', 'D', 'E','F']]) dot

` 5C639B00-3F59-4DD8-8964-B9F67BB43A54

E25B2920-29FE-4662-929D-794B9CA0B975

holzschu commented 3 years ago

Hi, thanks for raising the issue. graphviz (the Python package) require graphviz (the shell command), so I'll have to cross-compile it and install it.