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
-1
votes
0 answers

Given a 'small' graph (V, E) and a subset of its vertices, prune the graph

Trivial graph question. For a small DAG, meaning a few hundred vertices and probably never more than 1,000, given a few of the vertices v ⊂ V I want to remove all edges & vertices except those connecting v (edit: so the output may contain other…
user3779002
  • 419
  • 3
  • 12
-1
votes
0 answers

Is there a way to determine the status of a task currently running in a dag in airflow?

I have tried with multiple instances to get the current running tasks within a dag. ti = TaskInstance("task_id", default_args['start_date']) state = ti.current_state()``` and even on this : ``` ti = get_task_instance(DAG_NAME, "task_id",…
-1
votes
1 answer

What's a good data structure to store and work with a thesaurus?

I've been working for a few years on an English-language thesaurus project, which combines a few sources (e.g. WordNet, Wiktionary Thesaurus, Moby Thesaurus, Word2vec) to make a large thesaurus. Currently I have the data defined as a list of lists.…
-1
votes
1 answer

Airflow import task dependency from another file

My Airflow has 4 tasks. t1, t2, t3, t4 with task id as task_id1, task_id2, task_id3, task_id4 However, the order of execution of task: t1 >> t2 >> t3 >> t4 is to be read from a text file. Example: the text file will…
-1
votes
1 answer

Fail SQL query if there is at least one wrong record in any of 3 tables (wrong means rate column<=0)

I have 3 tables and I need to check if they have a positive number in the "rate" column. Tables have different schema but they all have a column named "rate". I am working with airflow and I created a DAG which has a task to check if the rate in not…
Sana
  • 216
  • 2
  • 12
-1
votes
1 answer

Is it possible to run a task in a dag based on the status of another task in the same dag?

I need to get the status of a task 'A' and trigger a task 'B' only if the task A is not in running state. Is there a possible way to do this in airflow?
-1
votes
1 answer

DAG Implementation in Python

def get_Indegree_Of_Vertices(self): for ele in self.graph.keys(): self.indegree[ele] = 0 for i in self.graph.values(): self.indegree[ele] += i.count(ele) return self.indegree def DAG(self, root): # Queue is…
-1
votes
1 answer

How to find a set of paths that cover all edges from source to sink in a DAG?

I have a directed acyclic graph (given by an adjacency matrix), a source node and a sink node. I would like to find a set of paths P of cardinality no more than the number of edges, from the source to the sink, such that for each edge e in the…
zdm
  • 485
  • 2
  • 11
-1
votes
1 answer

Explore Spark Execution Plan, number of Stages, etc

I need to optimize my pyspark code in order to have an execution plan as parallel as possible; I would know if there is a better way than the .explain method (that is unreadable) to explore the DAG, like a "normal" graph object. For example it would…
-1
votes
3 answers

Can I use Dijkstra's algorithm on DAG with negative weighted edges?

I understand that Dijkstra's algorithm cannot be used for negative weight edges since it could mess up distances for vertices already in the cloud. But what if the directed graph doesn't contain a cycle i.e directed acyclic graph (DAG)? I think…
-1
votes
1 answer

How to use xCom in airflow dag file using python operator?

I'm working on this airflow dag file to do some test with XCOM, but not sure how to use it between python operators. Can someone please help how to write the logic to pass a message between the python operators using XCOM push and pull functions.…
user9249103
-1
votes
1 answer

Process nodes and edges of a dot format graph in Java

I have a graph of dot format as String. I want to get its nodes, edges and their data for processing. I am looking for a Java library which processes a given dot format graph. An example would be appreciated. digraph G { rankdir=TB V1 [a=1, b=2,…
David
  • 61
  • 1
  • 10
-1
votes
1 answer

Directed acyclic graph / Tree: arrow direction

Is it more common to have arrows point to the children or it's parent(s)? Why would someone prefer one over the other?
Flip
  • 4,320
  • 1
  • 27
  • 45
-1
votes
1 answer

O(m+n) complex algorithm for shortest path in acyclic graph

What's a good algorithm that solves the single-source-shortest path problem for a given acyclic (no cyclec) graph in time O(m + n). My attempt was to do Dijkstra's Algorithm with a fibonacci heap, but that's O(m + nlogn).
-1
votes
1 answer

Object oriented graphs implementation in c++

I have to implement a simulation of the WWW on c++ using graphs, where the nodes are Webpages and the directed edges are URLs. In school, in our level, we are still starting in Object Oriented Programming, so they proposed to implement using the…
Salim Mahboubi
  • 496
  • 5
  • 15
1 2 3
61
62