[package] add simple graph data structure (#57337)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57337
Add a really simple graph data sturcutre for tracking dependencies. API
based on networkx, but I didn't want to require the dependency.
Differential Revision: D28114186
Test Plan: Imported from OSS
Reviewed By: VitalyFedyunin
Pulled By: suo
fbshipit-source-id: 802fd067017e493a48d6672538080e61d249accd