Archeometer.Analysis.Xref (Archeometer v0.4.2)

Functions for generating a dependency graph from a list of given modules.

Accepted output formats are "dot" (graphviz), "png" and "mermaid".

Link to this section Summary

Functions

Creates a dependency graph between the modules given as parameters

Takes a map representing the adjacency list of a graph, and renders it using the appropriante backend. This can be both plain text graph formats (mermaid or dot) or image formats (svg or png).

Link to this section Functions

Link to this function

gen_graph(modules, format, db_name \\ Repo.default_db_name())

Creates a dependency graph between the modules given as parameters

parameters

Parameters

  • modules is either a list of module names, e.g. [Foo.Bar, Foo.Rex, Foo.Zorg] or a tuple {application, namespace} where application is the name of a specific applciation or :none for all applications, and namespace is a specific namespace or "*".
  • format can be one of "dot" (graphviz), "png", or "mermaid".
  • db_name is the filename of the DB to be used. If not given uses default DB.

returns

Returns

  • The binary representing the graph, if the operation was completed successfully.
  • {:error, reason} if not.
Link to this function

render(content, format)

Takes a map representing the adjacency list of a graph, and renders it using the appropriante backend. This can be both plain text graph formats (mermaid or dot) or image formats (svg or png).

iex> render(%{"a" => ["b"], "b" => []}, "dot") =~
...> ~r/digraph G {\n  .*\n.*\n    "a" .*;\n    "b" .*;\n      "a" -> "b";\n}\n/
true

iex> render(%{"a" => ["b"], "b" => []}, "mermaid")
~s/graph TD;\n  id_0([a]);\n  id_1([b]);\n  id_0-->id_1;\n/
Link to this function

xrefs(modules, db_name)