Menu
Graphs
A graph is an object used to create artifacts with cyclic dependencies. Because objects are Merkle trees, they cannot form cycles. To get around this, graphs contain multiple nodes representing artifacts in a single object. The nodes then refer to one another by index, so they can form cycles.
# This package contains two modules.$ tree packagepackagefoo├ module.tg.ts└ tangram.ts# This module imports the default module.$ cat package/module.tg.tsimport "./tangram.ts";# The default module imports the other module.$ cat package/tangram.tsimport "./module.tg.ts";$ tg checkin ./packagedir_deadbeef$ tg get dir_01h83d1an5qmcd2dpt1ednssdnq5a639crnvp9v7nfxtqs1jkms3a0{ "graph": "gph_016ea9dft9j4mertzb5x33t0mgvbh917vq0m4sqdp4dyaja3gazaxg", "node": 0}$ tg get gph_016ea9dft9j4mertzb5x33t0mgvbh917vq0m4sqdp4dyaja3gazaxg{ "nodes": [ { "kind": "directory", "entries": { "module.tg.ts": 2, "tangram.ts": 1 } }, { "kind": "file", "contents": "lef_01rv5fervxp4chjtq8pt3p47wp5fxkh0p8mvs4zx1p3vy5dmakpjvg", "dependencies": { "./module.tg.ts": { "item": 0, "path": "", "subpath": "module.tg.ts" } } }, { "kind": "file", "contents": "lef_01aedpkwtxc2vb0jy7tav0rax7evgtneyj5sfvwc4vzkx52zxtrteg", "dependencies": { "./tangram.ts": { "item": 0, "path": "", "subpath": "tangram.ts" } } } ]}