Questions tagged [directed-acyclic-graphs]

Directed acyclic graphs appear in many data structures such a changeset graphs in distributed version control systems.

Definitions

A directed acyclic graph is directed graph with no cycles.
Graph - A collection of nodes with links between some pairs called arcs
Directed - A graph for which the arcs have a direction. Paths through the graph can only be used in one direction. If node 'x' links to node 'y', it does not automatically follow that node 'y' links to node 'x'.
Acyclic - A graph for which none of the vertices can be reached through a path starting with itself. A path can never reach the same node twice.

Synonyms

  • DAG
  • acyclic digraph

Common Uses

All trees can be represented as a directed acyclic graph. (But not all directed acyclic graphs are trees.)

920 questions
112
votes
13 answers

Can someone explain in simple terms to me what a directed acyclic graph is?

Can someone explain in simple terms to me what a directed acyclic graph is? I have looked on Wikipedia but it doesn't really make me see its use in programming.
yazz.com
  • 52,748
  • 62
  • 227
  • 363
86
votes
11 answers

How do I check if a directed graph is acyclic?

How do I check if a directed graph is acyclic? And how is the algorithm called? I would appreciate a reference.
nes1983
  • 14,012
  • 4
  • 42
  • 63
65
votes
2 answers

How DAG works under the covers in RDD?

The Spark research paper has prescribed a new distributed programming model over classic Hadoop MapReduce, claiming the simplification and vast performance boost in many cases specially on Machine Learning. However, the material to uncover the…
sof
  • 7,253
  • 13
  • 48
  • 74
39
votes
4 answers

How does 'git log --graph' or 'hg graphlog' work?

I know that the history in Git is stored in a data structure called a DAG. I've heard about DFS and know it's somewhat related. I'm curious, how do programs such as git log --graph or hg graphlog draw the history? I always thought it's quite…
39
votes
3 answers

How to run Spark code in Airflow?

Hello people of the Earth! I'm using Airflow to schedule and run Spark tasks. All I found by this time is python DAGs that Airflow can manage. DAG example: spark_count_lines.py import logging from airflow import DAG from airflow.operators import…
32
votes
3 answers

How do you store a Directed Acyclic Graph (DAG) as JSON?

I want to represent a DAG as JSON text and wondering if anyone has tried this and any issues they dealt with in regards to validating if the JSON is actually a DAG.
828
  • 1,060
  • 1
  • 12
  • 21
31
votes
1 answer

Algorithm for finding a Hamilton Path in a DAG

I am referring to Skienna's Book on Algorithms. The problem of testing whether a graph G contains a Hamiltonian path is NP-hard, where a Hamiltonian path P is a path that visits each vertex exactly once. There does not have to be an edge in G from…
31
votes
10 answers

Algorithm to find lowest common ancestor in directed acyclic graph?

Imagine a directed acyclic graph as follows, where: "A" is the root (there is always exactly one root) each node knows its parent(s) the node names are arbitrary - nothing can be inferred from them we know from another source that the nodes were…
27
votes
3 answers

DAG(directed acyclic graph) dynamic job scheduler

I need to manage a large workflow of ETL tasks, which execution depends on time, data availability or an external event. Some jobs may fail during execution of the workflow and the system should have the ability to restart a failed workflow branch…
23
votes
2 answers

Diff for Directed Acyclic Graphs

I'm looking for an algorithm which can diff two Directed Acyclic Graphs(DAGs). That is, I'd like an algorithm which produces a sequence of deletions and insertions on the first DAG to produce the second DAG. I'm not a hundred percent sure, but I…
Nomad010
  • 243
  • 4
  • 8
23
votes
10 answers

Hash value for directed acyclic graph

How do I transform a directed acyclic graph into a hash value such that any two isomorphic graphs hash to the same value? It is acceptable, but undesirable for two isomorphic graphs to hash to different values, which is what I have done in the code…
Neil G
  • 28,787
  • 31
  • 143
  • 234
23
votes
6 answers

ReadOnlyCollection vs Liskov - How to correctly model immutable representations of a mutable collection

Liskov-substitution principle requires that subtypes must satisfy the contracts of super-types. In my understanding, this would entail that ReadOnlyCollection violates Liskov. ICollection's contract exposes Add and Remove operations, but the…
22
votes
2 answers

Problems with a simple dependency algorithm

In my webapp, we have many fields that sum up other fields, and those fields sum up more fields. I know that this is a directed acyclic graph. When the page loads, I calculate values for all of the fields. What I'm really trying to do is to convert…
Coxy
  • 8,576
  • 4
  • 35
  • 61
20
votes
7 answers

DAG not visible in Web-UI

I am new to Airflow. I am following a tutorial and written following code. from airflow import DAG from airflow.operators.python_operator import PythonOperator from datetime import datetime, timedelta from models.correctness_prediction import…
Rusty
  • 696
  • 2
  • 8
  • 26
20
votes
1 answer

How to find the longest path in a graph with a set of start and target points?

I have a DAG (with costs/weights per edge) and want to find the longest path between two sets of nodes. The two sets of start and target nodes are disjoint and small in size compared to the total number of nodes in the graph. I know how to do this…
1
2 3
61 62