Visualizes Elixir project codebase as a Hierarchichal Edge Bundling graph.
Utilizes Mike Bostock's example implemented in D3.
git clone https://github.com/elixir-ecto/ecto.git /tmp/ecto
docker run --rm -v /tmp/ecto:/project \
-e MAX_DEPS_DEPTH=1 \
-e BUILTIN=false \
-e SHORTEN_MODULE_NAMES=false \
-e COLOR=lightsteelblue \
studzien/graf:latest /project \
> ecto.svg
After it finishes, ecto.svg
should look similar to this:
./priv/generate.sh
is an entrypoint to the script.
It takes Elixir projects directories as arguments and outputs a SVG with
Hierarchichal Edge Bundling graph representing structure of these projects.
Generation has two phases:
- An Elixir script (
priv/graf.exs
) first generates JSON with relationships between modules from provided projects and for given options; - A Node.js script (
priv/heb/index.js
) then generates a SVG from the JSON.
You can run this script locally, and not in the Docker container, but make sure you
have Node available and run make setup
first, that will install all JS dependencies.
All configuration of the generation script is currently done via environmental variables.
The available variables are:
MAX_DEPS_DEPTH
(default: 0) - how deep the generator should look into the dependencies when generating graph?BUILTIN
(default: false) - should built-in modules (likeEnum
orerlang
) be considered when generating the graph?SHORTEN_MODULE_NAMES
(default: true) - should the module name on the graph be shortened to the last part? (i.e.Graph
instead ofGraf.Graph
)COLOR
(default: #ccc) - the color of edges on the graph
Since the generator relies on running mix
in your project to gather information
like compile paths and checks whether it's an umbrella project, it might not work
properly if there is some output in the mix run
output, like logs.
A workaround for this is increasing log level or turning logging off for the time of graph generation.
If a graph can't be generated for your project or seems to be incorrect please create an issue describing the problem.