## Algorithms: minimum route coverage in a directed acyclic graph

Given a weighted directed acyclic graph G = (V, D, W) and a set of arches RE & # 39; of rewhere the weights of W They are at the vertices. The problem is partitioning Sun on a minimum number of paths separated from vertices that cover all vertices of Sun subject to restrictions that:

1. the weight of each route is maximum k.
2. each route must include at least one edge of D & # 39;

What is the complexity of this problem?

## Longer trajectory in an acyclic graph directed with restrictions

Given a directed weighted acyclic graph G = (V, D, W) and a subset of edges RE & # 39; of re. The problem is finding the longest path in Sun that goes through exactly one edge of RE & # 39;.

What is the complexity of this problem?

## algorithms: extraction of an expansion tree from a directed acyclic graph with a minimum total distance between terminal nodes

I have a directed acyclic graph that has uniform edge weights. I would like to extract from this graph an expansion tree (an arborescence) with the property that the total distance between all pairs of leaf nodes (the sum of the combined distances of the closest common ancestor of each pair) is minimized.

What I am finally trying to achieve is finding the best way to sort the leaf nodes so that the most related nodes are closer to each other on the list. If I can find the expansion tree as described, I can easily sort the leaf nodes the way I need.

Can anyone point me to a solution to this problem that is not just brute force optimization?

## Direct the partition of the acyclic graph into minimal subgraphs with a restriction

I have this problem, I am not sure there is a name for it, where a Directed Acyclic Graph has nodes of different colors. The idea is to divide it into a minimum number of subgraphs with the following 2 restrictions:

1. A sub-graph must have nodes of similar color
2. A subgraph cannot depend directly or indirectly on its own output

Example: – In the attached image, the subgraph with yellow nodes is not valid since the entry of the red node breaks rule # 2: the fourth node from above has an entry that depends on the output of the second node, through the node red (outside the subgraph
Therefore, the algorithm should divide it after # 2 or # 3 so that 2 and 4 are on different nodes

I am sure that this is a fairly common problem in graph theory and should have a name and a standard algorithm for it. Thanks in advance for any pointer to it!

## How to generate acyclic charts directed randomly?

The idea is that the graph is acyclical if and only if there is an ordering of vertices that makes the adjacency matrix inferior triangular¹. It is easy to see that if the adjacency matrix is ​​lower triangular, the vertex \$ i \$ can only point to the vertex \$ j \$ if \$ i <j \$.

Then we generate a matrix that has zeros and ones evenly distributed under the diagonal:

``````vertexCount = 10;
edgeCount = 30;

elems = RandomSample @
vertexCount (vertexCount - 1) / 2]adjacencyMatrix =
Drink[
FoldList[RotateLeft, elems, Range[0, vertexCount - 2]],
Everyone,
vertexCount
]~ Triangularize lower ~ -1
``````

(Thanks to @ Mr.Wizard for the code that fills the triangular matrix!)

``````graph = AdjacencyGraph[adjacencyMatrix]

AcyclicGraphQ[graph]

(* ==> True *)
``````

`LayeredGraphPlot` will show you the acyclic structure in a "convincing" way:

He did not say it explicitly, but I guess he needs a connected graphic. Unfortunately I do not have an algorithm that gives you a connected one, but you can continue generating them until you find one connected by accident (brute force). If the connectivity is very low and you get very few connected, you can try to generate graphics with a vertex count slightly higher than required until the largest connected component has the required vertex count.

Packed in a function for convenience:

``````randomDAG[vertexCount_, edgeCount_] /;
edgeCount <vertexCount (vertexCount - 1) / 2: =
Module

The
elems = RandomSample @
PadRight[ConstantArray[1, edgeCount], vertexCount (vertexCount - 1) / 2];
Drink[
FoldList[RotateLeft, elems, Range[0, vertexCount - 2]],
Everyone,
vertexCount
]~ Triangularize lower ~ -1;
]
``````

¹ You can find the order that makes the adjacency matrix triangular using a topological arrangement.

## Find a possible alternative algorithm to a maximum flow and a minimum cut to find the greatest benefit of an acyclic directed graph

They give me a set of n projects that could be preformed. Projects can not be started until other projects are completed. This set of dependencies is described by means of a directed acyclic graph, where an edge i -> 􏰁j indicates that project i depends on project j. The projects have weights that are in the vertices. The weights are both negative and positive. Negative weights are represented as positive costs, which will reduce your total benefit. I need to find a valid subset of the projects whose total benefit is as large as possible. The benefit is found by adding the weights together.

Example of the DAG:

Now, what you could do to solve this is to implement a minimum maximum flow cut algorithm to find the greatest benefit. Like Min-cut that would produce the best correct benefit of 2.

However, my question is: would there be an alternative way to solve this other than the implementation of a minimum cut? Possibly using graph theory algorithms instead of network flow?

## Search for connected components arranged topologically in a directed acyclic graphic

I am aware that the algorithms of topographic ordering and connected components are closely related, but I have been looking for an algorithm to compute both simultaneously, instead of one after the other, and I find it surprisingly difficult.

Assuming a directed acyclic graph, is it possible to simultaneously find the list of connected components at the same time that the nodes are topologically classified in each of the components?

To clarify, the output would be a list of components, where each component is a topological order of the nodes contained in that component.

Bonus points if the list of connected components is classified according to the order of insertion of the nodes in the graph (that is, the first connected component will contain the first node inserted in the graph, no matter of global topological order; etc for the later components).

## Search for strongly connected components arranged topologically in a directed acyclic graphic

I am aware that topology and strongly connected components are very related algorithms, but I have been looking for an algorithm to calculate both simultaneously, instead of one after the other, and I find it surprisingly difficult.

Assuming a directed acyclic graph, is it possible to simultaneously find the list of strongly connected components and at the same time topologically classify the nodes in each of the components?

To clarify, the output would be a list of components, where each component is a topological order of the nodes contained in that component.

Bonus points if the list of strongly connected components is ordered following the order of insertion of the nodes in the graph (that is, the first connected component will contain the first node that has been inserted in the graph, no matter of global topological order; etc for the later components).

## Algorithms for the isomorphism of the rooted acyclic graph

Given two acyclic charts directed. $$G_1$$ Y $$G_2$$, and its roots $$r_1$$ Y $$r_2$$, Is there a polynomial algorithm to determine if $$G_1$$ Y $$G_2$$ Are they isomorphic?