You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When looking at #784, I realised that calculate_dependency_graph produces a networkx graph of query dependencies but doesn't help much with actually visualising it. The docstring demonstrates how to export a .dot file, but this needs the external graphviz tool to actually visualise it (e.g. by converting to pdf).
It would be helpful to be able to draw dependency graph directly in a Jupyter notebook. Here is a useful snippet to export a dependency graph to a SVG, which can be rendered directly in the notebook:
import flowmachine
import networkx as nx
from flowmachine.features import daily_location
from flowmachine.utils import calculate_dependency_graph
from io import BytesIO
from IPython.display import SVG
flowmachine.connect(flowdb_user="flowdb", flowdb_password="flowflow", redis_password="fm_redis")
dl = daily_location(date="2016-01-01")
G = calculate_dependency_graph(dl)
A = nx.nx_agraph.to_agraph(G)
svg_str = BytesIO()
A.draw(svg_str, format="svg", prog="dot")
svg_str = svg_str.getvalue().decode("utf8")
svg = SVG(svg_str)
Would this be useful to provide as a helper in flowmachine? We probably want to avoid getting too fancy with dependency graph visualisation, but this seems like a useful addition. Thoughts?
The text was updated successfully, but these errors were encountered:
When looking at #784, I realised that
calculate_dependency_graph
produces a networkx graph of query dependencies but doesn't help much with actually visualising it. The docstring demonstrates how to export a.dot
file, but this needs the external graphviz tool to actually visualise it (e.g. by converting to pdf).It would be helpful to be able to draw dependency graph directly in a Jupyter notebook. Here is a useful snippet to export a dependency graph to a SVG, which can be rendered directly in the notebook:
Would this be useful to provide as a helper in flowmachine? We probably want to avoid getting too fancy with dependency graph visualisation, but this seems like a useful addition. Thoughts?
The text was updated successfully, but these errors were encountered: