Extracting a spanning tree from a directed acyclic graph with 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 a spanning tree (an arborescence) with the property that the total distance between all pairs of leaf nodes (the sum of combined distances from each pair’s nearest common ancestor) is minimized.

What I’m ultimately trying to accomplish is to find the best way of ordering the leaf nodes in such a way that the most closely related nodes are closest to each other in the list. If I can find the spanning tree as described, I can easily order the leaf nodes in the way I need.

Can anyone point me to a solution to this problem other than just brute force optimization?

campaigns spanning long time [on hold]

In my experience, campaigns often span a relative short amount of time, and i’d like to change this.

On one side, this is because downtime is often hard to play and justify and make meaningful: you’re an adventurer, why would you wait in a town for days when there’s adventure to be had? Travel around and find the new adventure if none is at hand!

Long voyages (when they happen) seem to be the only exception for time passing, (though often these are turned into interesting, sequences of brief events) it is hard to justify an adventure having to span months, or even years. Also, often these long voyages (3week +) change setting, which makes it hard for past actions to influence the future, which is what i’d like to achieve by having campaign that span longer in time.

What are plausible ways to add “span” to a campaign, so that it is plausible for the party to want to wait some months in a place (or in a set of places)?

These plausible ways would be sped-up at the table, the goal would be to have the world move on for months, while the table has not.

Number of Spanning Trees

We are given a graph G with N(numbered 1 to N) nodes and M edges.

Let’s create a big graph B with NK nodes (numbered 1 through NK) and MK edges. B consists of K copies of G ― formally, for each k (0≤k≤K−1) and each edge between nodes u and v in G, there is an edge between nodes u+kN and v+kN in B.

We take the complement of the graph B and name it H.

The task is to calculate the number of spanning trees in H.

Note : The maximum number of nodes in graph G is 20. The maximum value of K is 10^8. The graph G doesn’t have any self-loops or multiple-edges.

My approach : When the value of K is less than 40, I am being able to apply Kirchoff’s Matrix Tree theorem with a complexity of O(N^3)(Gaussian elimination gives us a O(n^3) algorithm to compute determinants). However,my solution doesn’t scale for very large graphs which are formed for high values of K. I am figuring I should be able to derive a formula to calculate the number of spanning trees because of the repeated copies of small graph G. But because of my limited mathematical knowledge, I am not being able to converge to a formula.

Any help would be greatly appreciated.

How do I design an efficient and easy layout for a settings page which has at least 200+ options spanning 18+ categories

The web app I am now working on as a pilot project for my learning has a very complex settings page. It has 18-20 main categories and tweaks about 200 configurations within these categories. There are 2 access levels, one is a manager and another is owner. Owner can see all changes, but doesn’t necessarily have to configure all of them. Manager can see only select tweaking options and has to configure things by himself.

Right now I am using a vertical tabbed approach. How can I improve it further?

Here’s the screenshot for reference


enter image description here

Finding minimum spanning tree of a special form graph

I’m trying to find an efficient algorithm that will find me the minimum spanning tree of an undirected, weighted graph of this particular form:

enter image description here

My idea was a recursive solution: Suppose the algorithm recieve the graph with n as a parameter,

if n==2 then:     take the lower cost path between vo-->v1-->v2 and v0-->v2 if n==1 then:     take the lower cost path between v0-->v2-->v1 (if v2 exists) and v0-->v1 else:     - recursivly call the algorithm for n-1     - take the lower cost edge between v0-->vn and v(n-1)-->vn 

I’m really not sure wheather this algorithm is correct, i was trying to prove this by induction and got a bit stuck at the base, which got me thinking maybe the algorithm is flawed.

Any suggestions would be much appreciated.

Finding minimum spanning tree with O(|V|)

Given an undirected weighted graph $ G(V,E)$ , where the number of edges is $ |V|+10$ , how can I find the minimum spanning tree of $ G$ in $ O(|V|)$ ?

Kruskal’s algorithm is out of the question, since sorting alone is $ O(|V|\log |V|)$ , so I thought maybe using Prim’s algorithm with minimum binary heap, but still – every iteration will cost $ \log |V|$ for updating vertices keys in the heap, so altogether it’s $ |V|\log |V|$ .
I know that the key here is to use the fact that $ |E|=|V|+10$ , so I start thinking maybe removing the 11 edges with the biggest weights, as long as the graph stays connected, but that’s obviously a bad idea since it’ll – again – require sorting.
I just can’t figure it out. Any help would be greatly appreciated.

Are edges in a minimum spanning tree not heavier than respective edges in another spanning tree?

Let $ G$ be an undirected connected weighted graph, and let $ T$ be a minimum spanning tree of $ G$ with edge weights: $ w_1 \le w_2 \le … \le w_{n-1}$ .

Now let $ T’$ be some other spanning tree of $ G$ (doesn’t have to be minimum) with edge weights: $ w’_1 \le w’_2 \le … \le w’_{n-1}$ .

I need to prove\disprove the following claim: for every $ i$ : $ w_i \le w’_i$ .

I’ve tried to find a counterexample, but I wasn’t successful. So I’m quite sure the claim is correct. However, I had trouble to prove it formally.

I assume the contrary, which means there is an $ i$ that satisfies $ w’_i < w_i$ and I take the first one that does. I tried adding it to the tree $ T$ or trying to find a minimum spanning tree with this edge using Kruskal, but no luck.

What are good ways to present an info table that has info spanning 2 vertically-adjacent cells in a middle column, & that has no other merged cells?

Explanation of question

The following table illustrates the issue:

HTML table that doesn't present info clearly enough

HTML source for table:

<table>  <thead><th>Column 1</th><th>Column 1</th><th>Column 3</th></thead>  <tr><td>Type 1</td><td rowspan="2">Common Info</td><td>Info 1</td></tr>  <tr><td>Type 2</td><td>Info 2</td></tr> </table> 

You’ll notice that it isn’t clear that the non-header cells in the first column map to their corresponding cells in the third column, because of the cell merging. How can such correspondence be made clear?

Anyone have any advice regarding this situation?

Possible Solution

If I could mark-up the following table design using HTML, such that the cell entries were not images, then I believe such presentation would be acceptable:

Design of table for presenting the unusual information in clear way

Unfortunately, I didn’t use HTML to create the above design—I just used a simple raster graphics editor (Windows Paint) to create it.


Whilst all compatible answers to this question are welcome, for myself, really, I want to find out how to mark-up such information using GitHub Flavoured MarkDown. See here for more information on the specific situation I’m trying to deal with, that prompted this StackExchange question.

Is every edge of a graph included in some spanning tree?

Let’s say we have a graph $ G$ . We pick one edge from it (any edge). Will there always be such a spanning tree that contains that very edge?

I think the answer is yes, because no matter what we do we can always create such a spanning tree so that the very edge we picked is included. Of course, a more formal proof would be needed?