Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visualizing a DAG

I have a large directed acyclic graph that I would like to visualize in a bitmap image.

Ideally I'd like to have all the root nodes at the top of the image, and all of the leaf nodes at the bottom, i.e. the graph edges are all pointing in a downwards direction.

Is there a good algorithm for working out the coordinates of all the nodes that meets these constraints and will produce a good visualization?

like image 751
mikera Avatar asked Aug 19 '10 14:08

mikera


People also ask

How do you represent a directed acyclic graph?

A directed acyclic graph (DAG) is a conceptual representation of a series of activities. The order of the activities is depicted by a graph, which is visually presented as a set of circles, each one representing an activity, some of which are connected by lines, which represent the flow from one activity to another.

How can you make a directed graph a DAG?

Any directed graph may be made into a DAG by removing a feedback vertex set or a feedback arc set, a set of vertices or edges (respectively) that touches all cycles.

How do you prove a graph is a DAG?

We can use Depth–first search (DFS) to solve this problem. The idea is to find if any back-edge is present in the graph or not. A digraph is a DAG if there is no back-edge present in the graph. Recall that a back-edge is an edge from a vertex to one of its ancestors in the DFS tree.

What is a DAG in Python?

A DAG in Airflow is simply a Python script that contains a set of tasks and their dependencies. The operator of each task determines what the task does. Using PythonOperator to define a task, for example, means that the task will consist of running Python code.


2 Answers

I advise you to use Gephi.

This soft is able to do all the things you want to, especially graph layouts !

like image 116
Guillaume Lebourgeois Avatar answered Sep 18 '22 17:09

Guillaume Lebourgeois


Look at the Graphviz software collection. It contains several programs to render graphs.

The most simple way is to write your graph to disk, in one of Graphviz's text formats. Then execute one of the render programs, and load the resulting image into your application.

like image 26
Eike Avatar answered Sep 18 '22 17:09

Eike