Skip to content

Instantly share code, notes, and snippets.

@cdaringe
Created March 3, 2018 20:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdaringe/b79bcc7f7a283afbb9e319fcbdcb7c50 to your computer and use it in GitHub Desktop.
Save cdaringe/b79bcc7f7a283afbb9e319fcbdcb7c50 to your computer and use it in GitHub Desktop.
console-terminal-task-graph.js
var simpleTree = {
a: {
dependsOn: [
'b',
'x'
]
},
x: {
dependsOn: [
'y'
]
},
y: {
dependsOn: [
'z'
]
},
z: {
dependsOn: [
'w'
]
},
w: {},
b: {
dependsOn: [
'c',
'd'
]
},
c: {},
d: {}
}
/*
w──┐
z──┐
y──┐
x──┐
d──┐ |
c--┤ |
b--------┤
a
*/
var treeWithDuplicateSubtrees = {
a: {
dependsOn: [
'b',
'x'
]
},
x: {
dependsOn: [
'b',
'y'
]
},
y: {
dependsOn: [
'z'
]
},
z: {
dependsOn: [
'w'
]
},
w: {},
b: {
dependsOn: [
'c',
'd'
]
},
c: {},
d: {}
}
/*
w──┐
z──┐
y──┐
b✓-┤ // dont replicate trees, but dont hide edges either. in this
x──┐ // case, w is a tree of h = 1,
d──┐ |
c--┤ |
b--------┤
a
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment