Notgnoshi / includegraph

Generate preprocessor #include dependency graphs from a Clang compilation database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

filtergraph.py filtering is nondeterministic

Notgnoshi opened this issue · comments

(includegraph) nots@bedlam ~/Documents/includegraph (ag/filter) $ ./filtergraph.py -i foo.tgf -f '*bar*' >/dev/null
2022-07-26 13:36:09,880 - filtergraph - INFO - Parsed 1123 nodes
2022-07-26 13:36:09,880 - filtergraph - INFO - Filtering graph...
2022-07-26 13:36:09,906 - filtergraph - INFO - Removed 798 nodes
(includegraph) nots@bedlam ~/Documents/includegraph (ag/filter) $ ./filtergraph.py -i foo.tgf -f '*bar*' >/dev/null
2022-07-26 13:36:30,296 - filtergraph - INFO - Parsed 1123 nodes
2022-07-26 13:36:30,296 - filtergraph - INFO - Filtering graph...
2022-07-26 13:36:30,322 - filtergraph - INFO - Removed 829 nodes
(includegraph) nots@bedlam ~/Documents/includegraph (ag/filter) $ ./filtergraph.py -i foo.tgf -f '*bar*' >/dev/null
2022-07-26 13:36:49,054 - filtergraph - INFO - Parsed 1123 nodes
2022-07-26 13:36:49,054 - filtergraph - INFO - Filtering graph...
2022-07-26 13:36:49,079 - filtergraph - INFO - Removed 819 nodes
(includegraph) nots@bedlam ~/Documents/includegraph (ag/filter) $ ./filtergraph.py -i foo.tgf -f '*bar*' >/dev/null
2022-07-26 13:36:50,459 - filtergraph - INFO - Parsed 1123 nodes
2022-07-26 13:36:50,459 - filtergraph - INFO - Filtering graph...
2022-07-26 13:36:50,483 - filtergraph - INFO - Removed 833 nodes
(includegraph) nots@bedlam ~/Documents/includegraph (ag/filter) $ ./filtergraph.py -i foo.tgf -f '*bar*' >/dev/null
2022-07-26 13:36:51,887 - filtergraph - INFO - Parsed 1123 nodes
2022-07-26 13:36:51,887 - filtergraph - INFO - Filtering graph...
2022-07-26 13:36:51,912 - filtergraph - INFO - Removed 824 nodes

This is because set iteration order is nondeterministic, so each BFS searches starting at a random node.

But even with random iteration order, the number of nodes filtered should be the same.