mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: add edges (straight line for now)
This commit is contained in:
1 parent
ca36f6391a
commit
9ddfcd2a86
2 files changed
+32
-15
No files matched your search
@@ -5,12 +5,12 @@ interface Node {
|
||||
|
||||
export default class DAG {
|
||||
private nodes = new Map()
|
||||
private edges = new Set()
|
||||
private edges = new Set<[string, string]>()
|
||||
private layers: number[] = []
|
||||
|
||||
constructor(nodes: Node[]) {
|
||||
this.nodes = new Map(nodes.map((node) => [node._id, node]))
|
||||
this.edges = new Set()
|
||||
this.edges = new Set<[string, string]>()
|
||||
this.nodes.forEach((_, id) => {
|
||||
this.setLayer(id)
|
||||
this.addEdges(id)
|
||||
|
||||
Reference in new issue
Block a user