directed-acyclic-graphs

Data Structure to represent a DAG in Javascript

坚强是说给别人听的谎言 提交于 2019-12-05 13:03:33
I have a string that I need to parse into a graph (DAG) data structure using javascript. Included in the data structure are a few attributes I should store, such as the node's id, name, and a label that is given to the link if one exists to another node. So, an example would be Node1 (id: 1, name: 'first') --('link name')--> Node2 (id:....) and so forth. Once the data structure is created I do not need to do any more operations on it other than read it (I will later use it to render a visualization with d3). The amount of nodes will not be very many, as several of them are shared. I am

Airflow latency between tasks

时光毁灭记忆、已成空白 提交于 2019-12-05 12:10:14
As you can see in the image : airflow is making too much time between tasks execution ? it almost represents 30% of the DAG execution time. I've changed the airflow.cfg file to: job_heartbeat_sec = 1 scheduler_heartbeat_sec = 1 but I still have the same latency rate. Why does it behave this way ? It is by design. For instance I use Airflow to perform large workflows where some tasks can take a really long time. Airflow is not meant for tasks that will take seconds to execute, it can be used for that of course but might not be the most suitable tool. With that said there is not much that you

Giving an example of a cycle in a directed graph

流过昼夜 提交于 2019-12-04 23:57:03
问题 I want an algorithm that gives one instance of a cycle in a directed graph if there is any. Can anyone show me a direction? In pseudo-code, or preferably, in Ruby? I previously asked a similar question, and following the suggestions there, I implemented Kahn's algorithm in Ruby that detects if a graph has a cycle, but I want not only whether it has a cycle, but also one possible instance of such cycle. example_graph = [[1, 2], [2, 3], [3, 4], [3, 5], [3, 6], [6, 2]] Kahn's algorithm def

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

試著忘記壹切 提交于 2019-12-04 22:24:53
Liskov-substitution principle requires that subtypes must satisfy the contracts of super-types. In my understanding, this would entail that ReadOnlyCollection<T> violates Liskov. ICollection<T> 's contract exposes Add and Remove operations, but the read only subtype does not satisfy this contract. For example, IList<object> collection = new List<object>(); collection = new System.Collections.ObjectModel.ReadOnlyCollection<object>(collection); collection.Add(new object()); -- not supported exception There is clearly a need for immutable collections. Is there something broken about .NET's way of

Directed Acyclic Graph with multi-parent nodes

孤街醉人 提交于 2019-12-04 19:24:50
Given: A directed acyclic graph with weighted edges, where a node can have multiple parents. Problem: For each child of root node, find a minimum-cost(sum of weights) path from such a child to some leaf which can be reached. A node can only be present in one such min-cost paths. Example graph: In the above graph, for node 2, all the available paths are: 2 -> 5 2 -> 1 -> 9 -> 6 2 -> 1 -> 10 -> 6 Among which 2 -> 1 -> 10 -> 6 has minimum cost of 3.5 Similarly, for node 4, all the available paths are: 4 -> 11 -> 8 4 -> 7 -> 10 -> 6 Among which 4 -> 7 -> 10 -> 6 has minimum cost of 3.0 The result

Finding the width of a directed acyclic graph… with only the ability to find parents

你。 提交于 2019-12-04 12:44:45
I'm trying to find the width of a directed acyclic graph... as represented by an arbitrarily ordered list of nodes, without even an adjacency list. The graph/list is for a parallel GNU Make-like workflow manager that uses files as its criteria for execution order. Each node has a list of source files and target files. We have a hash table in place so that, given a file name, the node which produces it can be determined. In this way, we can figure out a node's parents by examining the nodes which generate each of its source files using this table. That is the ONLY ability I have at this point,

How to derive FRP from Directed Acyclic Graphs?

帅比萌擦擦* 提交于 2019-12-04 10:36:39
问题 I am currently researching for my next project. This is in a pre-planning phase so this question is just to get an overview on existing technology. Setup I have a directed acyclic graph (DAG) with multiple inputs and output, think artificial neuronal network for now: The common way to process such a structure is to process the whole network on every (time-)step. I believe that is the method used by frp libraries such as netwire. Now I am in the fortunate position that I have a stream of

Directed, acyclic graph in d3.js

风流意气都作罢 提交于 2019-12-04 08:37:19
问题 Is there a reliable way of drawing directed, acyclic graphs in D3.js today? I'm trying to visualize prerequisites in a curriculum, similar to this. I've seen some older answers to similar questions with the most promising lead being this hack, though it doesn't work reliably well with larger and more complex data sets. Is this simply a rare case of a visualization that D3 is not ideal for? 回答1: You may have a try to dagre, a JS library for DAG graphs. If you want to use d3 for whatever reason

Is DAG created when we perform operations over dataframes?

有些话、适合烂在心里 提交于 2019-12-04 06:16:25
问题 I have seen DAG getting generated whenever we perform any operation on RDD but what happens when we perform operations on our dataframe? When executing multiple operations on dataframe, Are those lazily evaluated just like RDD? When the catalyst optimizer comes into the picture? I am sort of confused between these. If anyone can throw some light on these topics, it would be really of great help. Thanks 回答1: Every operation on a Dataset , continuous processing mode notwithstanding, is

Algorithm to transform a workflow DAG into parallel resource allocation?

血红的双手。 提交于 2019-12-04 05:36:16
Say I have a graph where nodes are workloads of various kinds and edges are dependencies between the workloads. (This is a DAG since cyclical dependencies must not exist.) I also have a set of multiple agents who can perform the work. Some workload varieties may be given to any agent, others must be given to a specific agent, and others must be given to one agent among a particular group of agents. How do I assign workloads such that: No workload is given to an agent until all its blocking workloads are completed The shortest possible time is required to complete the total workload graph.