sambrightman / asciidag Goto Github PK
View Code? Open in Web Editor NEWDraw DAGs (directed acyclic graphs) as ASCII art, à la Git
License: GNU General Public License v2.0
Draw DAGs (directed acyclic graphs) as ASCII art, à la Git
License: GNU General Public License v2.0
The following graph seems to break:
n1 = Node('N1')
n2 = Node('N2')
n3 = Node('N3')
n4 = Node('N4')
n5 = Node('N5')
n6 = Node('N6')
n7 = Node('N7')
n8 = Node('N8')
n9 = Node('N9')
n10 = Node('N10')
n11 = Node('N11')
n12 = Node('N12')
n13 = Node('N13')
n14 = Node('N14')
n15 = Node('N15')
n16 = Node('N16')
n17 = Node('N17')
n18 = Node('N18')
n19 = Node('N19')
n20 = Node('N20')
n21 = Node('N21')
n22 = Node('N22')
n23 = Node('N23')
n24 = Node('N24')
n25 = Node('N25')
n26 = Node('N26')
n27 = Node('N27', parents=[n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20, n21, n22, n23, n24, n25, n26])
n28 = Node('N28', parents=[n27])
n29 = Node('N29', parents=[n27])
n30 = Node('N30', parents=[n28, n29])
n31 = Node('N31', parents=[n30])
n32 = Node('N32', parents=[n31])
n33 = Node('N33', parents=[n32, n31])
n34 = Node('N34', parents=[n30])
n35 = Node('N35', parents=[n34])
n36 = Node('N36', parents=[n35, n34])
n37 = Node('N37', parents=[n30])
n38 = Node('N38', parents=[n37])
n39 = Node('N39', parents=[n38, n37])
n40 = Node('N40', parents=[n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20, n21, n22, n23, n24, n25, n26, n33, n36, n39])
n41 = Node('N41', parents=[n40, n27])
graph = Graph()
graph.show_nodes([n41])
whereas GrapViz suggests that this is still a DAG:
digraph {N1;N2;N3;N4;N5;N6;N7;N8;N9;N10;N11;N12;N13;N14;N15;N16;N17;N18;N19;N20;N21;N22;N23;N24;N25;N26;N27;N28;N29;N30;N31;N32;N33;N34;N35;N36;N37;N38;N39;N40;N41;N1 -> N27;N2 -> N27;N3 -> N27;N4 -> N27;N5 -> N27;N6 -> N27;N7 -> N27;N8 -> N27;N9 -> N27;N10 -> N27;N11 -> N27;N12 -> N27;N13 -> N27;N14 -> N27;N15 -> N27;N16 -> N27;N17 -> N27;N18 -> N27;N19 -> N27;N20 -> N27;N21 -> N27;N22 -> N27;N23 -> N27;N24 -> N27;N25 -> N27;N26 -> N27;N27 -> N28;N27 -> N29;N28 -> N30;N29 -> N30;N30 -> N31;N31 -> N32;N32 -> N33;N31 -> N33;N30 -> N34;N34 -> N35;N35 -> N36;N34 -> N36;N30 -> N37;N37 -> N38;N38 -> N39;N37 -> N39;N1 -> N40;N2 -> N40;N3 -> N40;N4 -> N40;N5 -> N40;N6 -> N40;N7 -> N40;N8 -> N40;N9 -> N40;N10 -> N40;N11 -> N40;N12 -> N40;N13 -> N40;N14 -> N40;N15 -> N40;N16 -> N40;N17 -> N40;N18 -> N40;N19 -> N40;N20 -> N40;N21 -> N40;N22 -> N40;N23 -> N40;N24 -> N40;N25 -> N40;N26 -> N40;N33 -> N40;N36 -> N40;N39 -> N40;N40 -> N41;N27 -> N41;}
When I run this code, an error occurred.
from asciidag.graph import Graph
from asciidag.node import Node
graph = Graph()
nodeA = Node('A', parents=[])
nodeB = Node('B', parents=[])
nodeC = Node('C', parents=[])
nodeD = Node('D', parents=[nodeA, nodeB, nodeC])
tips = [
Node('E',
parents=[
Node('F', parents=[nodeC, nodeD]),
Node('G', parents=[Node('H', parents=[nodeD]), nodeD])
])
]
graph.show_nodes(tips)
This is the log.
Sometimes "asciidag" may succeed, which will print the right graph.
I have tested on python3.5.2, and it will pass when first run but failed afterward. I never success on python 3.9.2.
A simple linear dag has a slightly confusing output like this:
step_1
step_2
step_3
step_4
Which maybe someone wouldn't realize is a dag at first glance (without context). I thought maybe it would be nice to have pipes to indicate that there is still a transition like:
step_1
|
step_2
|
step_3
|
step_4
I started to look into this change, but I thought that maybe this was inconsistent with the goal of reaching 1-1 parity with the git dag output. If so feel go ahead and close this one.
Two of the three tests are being skipped because tree evaluation order looks wrong.
Other tests from Git's t/t6016-rev-list-graph-simplify-history.sh
should be converted and added.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.