Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(graph): also generate the transitive reduction #2282

Merged
merged 4 commits into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions scripts/graph.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash
# Generates visualizations of the internal package dependency graph.
# Also generates visualizations of the transitive reduction (tred) of
# that graph, which is the minimal graph with the same *transitive*
# dependencies. Much more legible by itelf. Seeing the two side by side
# often helps to understand the full picture.
set -ueo pipefail
DIR=$(dirname -- "${BASH_SOURCE[0]}")
{
Expand All @@ -20,12 +24,16 @@ DIR=$(dirname -- "${BASH_SOURCE[0]}")
'
echo '}'
# normalize
} | dot -Tcanon >packages-graph.dot
dot -Tpng <packages-graph.dot >"$DIR"/../packages-graph.png
} | dot -Tcanon > packages-graph.dot
dot -Tpng <packages-graph.dot > "$DIR"/../packages-graph.png

dot -Tsvg <packages-graph.dot >"$DIR"/../packages-graph.svg
dot -Tsvg <packages-graph.dot > "$DIR"/../packages-graph.svg

if acyclic packages-graph.dot | dot -Tcanon >packages-graph-sans-cycles.dot; then
tred <packages-graph.dot > packages-graph-tred.dot
dot -Tpng <packages-graph-tred.dot > "$DIR"/../packages-graph-tred.png
dot -Tsvg <packages-graph-tred.dot > "$DIR"/../packages-graph-tred.svg

if acyclic packages-graph.dot | dot -Tcanon > packages-graph-sans-cycles.dot; then
echo "No cycles in 'dependencies' of packages."
else
echo "Cycles detected. These lines appear only in the original graph and not the acyclic variant:"
Expand Down
Loading