Orientation of undirected graph, give an algorithm to mimize the maximum in-degree of any node

I’m trying to solve this question.

Given: An undirected graph G = (V,E)

Output: An orientation of G so as to minimize the maximum in-depth of any node.

So we have undirect graph G. We can create a directed graph by giving each edge direction. For example, e=(u,v) can be an edge from u to v or v to u. We want to minimize the max in-depth degree of any node for the new directed graph.

I’m trying to come up with a poly-time algorithm.

  1. we give an arbitrary direction to each edge.

  2. calculate the current max in-degree of the node.

  3. change each edge direction and repeat 2, if it is smaller, then update the max.

1 needs E times.

2 needs E + V to check.

3 needs E iterations

Total is E + E * (E + V)

so the total is O(E* (E+V)). Does this work?

Can Raise Dead revive a character with zero maximum Hit Points?

So, a character died from Draining Kiss of a succubus and his Max HP is 0. Can he be restored by Raise Dead, or does he need a higher level spell? Or a Greater Restoration cast on his lifeless body before Raise dead? I’m probably interested in RAW interpretation, since the character is in Adventurerer’s league.

Using decision oracle to solve optimization problem of maximum polyomino tiling

So, this problem is a kind of variant of polyomino packing which has been discussed frequently elsewhere, but I haven’t been able to find anything on my particular problem. Suppose we have a list of polyominos $ p_1, p_2, …, p_n$ (not necessarily distinct), and we want to find a tiling of a rectangle of dimension $ a \times b$ with $ a, b \leq n$ that maximizes the number of squares covered, where we can use each $ p_i$ at most once, and polyominos must be fully contained within the rectangle. Now, we have the decision problem which tells us, for a given $ t$ , if there is some tiling covering at least $ t$ squares, and the optimization problem which is finding a tiling that covers the maximum number of squares. There are two parts: first, if you can solve the optimization problem in polynomial time, can you solve the decision problem in polynomial time? And secondly, if you can solve the decision problem in polynomial problem, can you solve the optimization problem in polynomial time?

If we have an oracle that solves the optimization in polynomial time, solving the decision problem in polynomial time is easy. However, given an oracle for the decision problem, I was unable to find a way to solve the optimization problem in polynomial time. The main issue I’m facing is that the decision oracle only works for rectangular boards, which means we can’t just place pieces and then use the oracle to see if the placement works, since we won’t have a rectangular board if we want to exclude the piece we just placed. It isn’t hard to determine the actual maximum number of tiles you can cover, and you can even find the actual pieces you need to use, but I haven’t been able to figure out a way to find an arrangement of the pieces in polynomial time using the oracle. I assume there is some trick here, but I don’t see it.

What are the maximum hit points of an NPC?

Every player at a D&D table knows both their character’s current and maximum hit points at any given time.

I, as the DM determine the current hp of any NPC that the players encounter, either by rolling dice or taking an average value. But I am wondering: what is the maximum hit point value for any given NPC?

I need this information, so I can determine:

  • To what maximum an NPC can be healed by the player’s healing spells or heal itself with hit dice during a short rest
  • How much damage beyond 0 HP will kill the NPC outright (if I determine it has to make death saving throws, instead of dying at 0 HP)

I see three options:

  • NPCs do not have a maximum hit point value
  • The maximum hit point value is the same value as the current hit points that you determined, when the NPC appeared.
  • The maximum hit point value is the maximum possible value, that the NPC could have according to its hit dice and constitution modifier

Are there any rules on how to handle this?

Tight analysis for the ration of $1-\frac{1}{e}$ in the unweighted maximum coverage problem

The unweighted maximum coverage problem is defined as follows:

Instance: A set $ E = \{e_1,…,e_n\}$ and $ m$ subsets of $ E$ , $ S = \{S_1,…,S_m\}$ .

Objective: find a subset $ S’ \subseteq S$ such that $ |S’| = k $ and the number of covered elements is maximized.

The problem is NP-hard, but a simple greedy algorithm (at each stage, choose a set which contains the largest number of uncovered elements) achieves an approximation ratio of $ 1-\frac{1}{e}$ .

In the following post, there is an example of when the greedy algorithm fails.

Tight instance for unweighted maximum coverage problem?

I wish to prove that the approximation ration for the greedy algorithm is tight. That is, the greedy algorithm is not an $ \alpha-$ approximation ratio for any $ \alpha > 1-\frac{1}{e}$ .

I think that if I will find, for any $ k$ , (or for an ascending series of $ k’s$ ), an instance where the number of elements covered by greedy algorithm is $ 1-(1- \frac{1}{k})^k$ times the number of elements covered by the optimal solution, the tightness of the ratio will be proved.

Can someone give a clue for such instances?

I thought of an initial idea: let $ E = \{ a_1 ,…a_n,b_1,…,b_n,…,k_1,…,k_n\}$ , a set with $ n\cdot k$ elements. Let $ S$ include $ k$ sets of $ n$ elements each, $ A = \{ a_1 ,…a_n\},…,K= \{k_1,…,k_n\}$ . The optimal solution will select these $ k$ sets and cover all the elements in $ E$ . Now I want to add $ k$ sets to $ S$ , that will be the solution the greedy algorithm will find, and will cover $ 1-(1- \frac{1}{k})^k$ of the elements in $ E$ . The first such set, of size $ n$ : $ S_1 = \{a_1,…a_\frac{n}{k},b_1,…b_\frac{n}{k},…,k_1,…k_\frac{n}{k} \}$ ($ \frac{n}{k}$ elements from each of the first $ k$ sets). The second such set, of size $ n – \frac{n}{k}$ : $ S_2 = \{a_\frac{n}{k},…a_{\frac{n}{k}+ (n – \frac{n}{k})\cdot\frac{1}{k}},b_\frac{n}{k},…,b_{\frac{n}{k}+ (n – \frac{n}{k})\cdot\frac{1}{k}},…,k_\frac{n}{k},…,k_{\frac{n}{k}+ (n – \frac{n}{k})\cdot\frac{1}{k}} \}$ , (that is, $ (n – \frac{n}{k})\cdot\frac{1}{k}$ elements from each of the first $ k$ sets) and so on till we have $ k$ additional such sets.

I don’t think this idea works for every $ k$ and $ n$ , and I’m not sure it’s the right approach.


how to check whether a flow network contains unique maximum flow?

I have been stuck on this problem for few hours, my assignment asks to design an efficient algorithm(polynomial running time) that check whether a given flow network graph contains a unique maximum flow or not. I have been search everything I could, and some people said run an algorithm that able to find a max flow first, then modified the edges capacity, and run the algorithm one more time to see if we get the same flow value. But this seems never works for me especially when we are given arbitrary flow network, like non-integer flow graph. How should I start a good approach? (Literally stuck for few hours)

What is the maximum number of attacks given the below constraints for AD&D?

A former DM has had the same recurring NPC/GMPC since I started playing in his game. This was 20+ years ago and we started in 1st edition and slowly made our way through the years and editions. We updated our characters as we went to the new editions. Now this NPC/GMPC is the most reviled in his games, any time he shows up all the players immediately want him dead. We stick to character though.

The question will be broken up to hopefully get expert answers from each of the editions in which we played in this particular question it will be specific to 1e. I am skipping 4e (as we all hated it and only played one session) and 5e because I know for a fact that it is not possible there (yet).

The question is as follows:

Give the following constraints what is the maximum number of attacks in this edition:

  1. NPC is an Elf (This is just to set the prerequisite for the below multiclass possibility).
  2. He was a Thief-Acrobat and I assume multiclassed, probably Fighter-Thief.
  3. The weapon of choice was throwing knives.
  4. Assume unlimited ammunition as he had a bandalier that had the knives return.
  5. I know he could throw 3 knives at a time (pretty sure this was a thing for shuriken from Oriental Adventures).
  6. Assume all official sources and Dragon Magazine since the first issue are open.
  7. I know of this question and assume there is a variant with knives.
  8. If I recall he threw with both hands as well.
  9. We were always between 8th and 15th level when I met this character.
  10. I do not recall spell-casting but not ruling it out entirely but main build would likely have been focused on mundane means.
  11. Assume focused magical item augmentation as well, just calling it out even though the aforementioned bandolier alluded to it, but for the most part official items other than that.

The end result in game was quite literally at least 2 dozen attacks per round, perhaps more. Which I have questioned him multiple times about the build and legitimacy but he as refused to provide any answers. I know DMs do not have to justify but this, combined with a number of other things over the years has lead to distrust. I have since stopped playing his games altogether, so this is just a verification on whether I have overreacted.

This was broken into 3 questions for each of the editions.

AD&D, AD&D 2nd Edition, and Dungeons & Dragons 3.X.

Function of Maximum and Minimum Functions of Two Functions

I try to answer this question The Maximum and Minimum Functions of Two Functions

I wrote the following code

f[x_, y_] := 1 + 2*x + 3*y^3 g[x_, y_] := y + x^2 maxi[x_, y_] :=   Refine[{(f[x, y] + g[x, y])/2 + Abs[f[x, y] - g[x, y]]/2},    Assumptions -> {0 <= x <= 1, 0 <= y <= 1}] Plot3D[maxi[x, y], {x, 0, 1}, {y, 0, 1}] 

Is there any way to find function of maxi?