I came up with a way to modify Dijkstra’s Algorithm to handle graphs with some negative edge weighs (as long as there are no negative cycles) [duplicate]

This question already has an answer here:

  • Why can't we find shortest paths with negative weights by just adding a constant so that all weights are positive? 2 answers
  1. Let $ w_{min} < 0$ be the lowest weight of an edge in $ G$ .
  2. Add a constant $ c\geq |w_{min}|$ to each edge of $ G$ , so that each edge now has non-negative weight.
  3. Run Dijkstra’s algorithm on this modified graph.
  4. Compensate for the added weighs on each edge by subtracting them from the total distance.

Can anyone tell me if this is viable or if it fails?

Is there anything that prevents this “Negative AC armor” creation process to function?

This is a follow-up to a portion of this answer to a previous question of mine pertaining to the lowest possible achievable AC. The question is also slightly different as it pertains to magical armor and is limited in scope to Adventurers League play.

Currently, there are two monsters in the game with an ability to damage a Magical armor’s AC value : Zorbos…

Destructive Claws. […] one such item worn or carried by the creature (the targets choice), magically deteriorates, taking a permanent and cumulative -1 penalty to the AC it offers […]. Armor reduced to an AC of 10 […] is destroyed.

…And the Demon Lord Juiblex :

Eject Slime. […] Any metal armor worn by the target takes a permanent −1 penalty to the AC it offers […]. The penalty worsens each time a target is subjected to this effect. If the penalty on an object drops to −5, the object is destroyed.

The destruction clauses are different : one is when the Armor’s AC=10, one is when the Armor’s penalty=-5.

Now, let’s say you take a +1 Plate magic item (AC of 19). Your DM somehow agrees to add a Zorbo into your game (if they can find a thematically appropriate justification), and said Zorbo successfully reduces your Magical Plate’s AC 8 times, making it go to AC 11. Then, your DM somehow agrees to add the Demon Lord Juiblex into your game (again, with a thematically appropriate justification), which successfully reduces your Magical Plate’s AC 4 times, making it go to AC 7. At this point, you go back to the Zorbo, who successfully reduces your Plate’s AC once more. At this specific point, the armor’s AC is already lower than 10, and its total penalty is already higher than 5, so, to my understanding, this new reduction doesn’t activate either of the 2 destruction clauses. And thus, the Zorbo reduces it again, and again, and again, until the armor reaches a (potentially infinitely) negative AC value.

My question is : is there anything I forgot to consider — anything that would make the above “negative AC armor” creation process not function within the scope of Adventurers League play ?

For the record, I want such negative AC armor on a Redemption Paladin to symbolize a divine punishment by his goddess (he’s been naughty).

Positive and negative effects of being permanently deaf PC

I’m creating a deaf Fighter for a campaign, which I hope will last a while (10-12 sessions). The DM has allowed it, but we have not yet agreed on how the deafness affect my PC mechanically (I used gestures and sign language known only by the party, kind of home sign language, for the roleplay). However, we have agreed that the deafness must have a meaningful impact to the PC mechanically.

This answer suggest that there are both pros and cons being deaf. Except failing ability checks that require hearing, what is the complete list of other effects (both positive and negative) of being deaf?

Things I’m not sure of is whether there is penalty to passive and active perception and when casting spell (I heard there is failure chance?)

Why does arithmetic left shift of negative number leads to positive number?

According to this Wikipedia article, when arithmetic left shift operation is applied to a signed number, the number is multiplied by 2. But there are certain situations where a negative number becomes a positive number when an arithmetic left shift is applied.

Eg.: Take a 2’s complement signed integer -5 and 5 bits are used to represent it.

11011 ==> -5 10110 ==> -10 (-5x2) 01100 ==> +24 (?) 

So after two arithmetic left shifts -5 became 24. I expected -20. Why is this the case?

Why I get negative values on using periodogram after Fourier analysis?

sorry for bothering you with this question today. I am trying to analyze wave data that was produced using a wave tank. The period used for the waves is 1.7s, the waves encountered an obstacle at some point and then reflections are expected.

I plotted one of the sensors that are a wave gauge system. And I obtained the next plot:

Imaage of wave amplitude vs time

The x is the time in seconds and the y the wave height in mm. After this I use the code:

ListLinePlot[Abs[Fourier[datcy]], PlotRange -> All] 

And then I get the Fourier transform and I also plot just the data:

Fourier transform of the data data plotted

I know the plot is reflected and that is why I have a double one, but what I don’t get in wolfram or maybe on signal analysis is how I get a power spectrum that is negative after this:

Periodogram[datcy[[All, 2]], Frame -> True,  

GridLinesStyle -> Directive[Red, Dashed], PlotRange -> All]

Power spectrum

It’s on DB?, if that is true then technically there are no negative values and I should interpret as a -150 DB?. I am a bit lost here. Also, have a bit of doubt about why the amplitude of the Fourier plot doest not relate to the amplitude of my wave?.

Bellman ford – negative cycle

This is my code for detecting a negative cycle in a graph using bellman ford algorithm but I can’t figure out why it returns a wrong answer

public static final int INF = Integer.MAX_VALUE; private static int negativeCycle(ArrayList<Integer>[] adj, ArrayList<Integer>[] cost) {     int dep[] = new int[adj.length];     for(int i=0; i<adj.length; ++i)         dep[i] = INF;      dep[0] = 0;      for (int i = 0; i < adj.length-1; i++) {         for(int j = 0; j < adj.length; j++){             for (int v : adj[j]) {                 int v_index = adj[j].indexOf(v);                 if (dep[v] > dep[j] + cost[j].get(v_index)) {                     dep[v] = dep[j] + cost[j].get(v_index);                  }             }         }     }      for (int j = 0; j < adj.length; j++) {         for (int v : adj[j]) {             int v_index = adj[j].indexOf(v);             if (dep[v] > dep[j] + cost[j].get(v_index)) {                 return 1;             }         }     }      return 0; }