Title: Detecting Negative Cost Cycles in Zero Space
1Detecting Negative Cost Cycles in Zero Space
- K. Subramani
- West Virginia University
2Topics to be covered
- Statement of Problem
- Motivation
- Related Work
- The Difference Constraint Approach
- The Stressing Algorithm
- Analysis (Space and Time)
- Visualizing the algorithm
- Correctness
- Differences between Stressing and Relaxing
- Producing the cycle
- Open Issues
3Statement of Problem
NCCD Given a network GltV,E,cgt, is there a
directed, simple cycle with cumulative edge cost
negative?
4Motivation (for studying NCCD)
- Shortest Paths
- Max Flows
- Image Segmentation
- Real-Time Scheduling
- System Verification
5Motivation (for our work)
- New Design Paradigms
- ? NCCD and Shortest Paths
- Space Savings
- Connectivity issues
-
6Related Work
- Relaxation-based approaches
- Contraction-based approaches
- Algebraic Methods
7The Difference Constraint Approach
- Def A constraint of the form
- Def A conjunction of difference constraints is
called a - difference constraint system
- Farkas Lemma.
- Main observation
8DCA (contd.)
Adding the non-positivity constraints makes the
constraint polyhedron pointed indeed there is a
unique optimal solution to the system
System (1)
(Proof in paper)
9DCA (contd.)
- If the RHS is positive, suffices.
- Pick the constraint , with
-
- Replace xi by xicij,
- throughout the constraint system.
- 4. oioicij
Analysis At most steps and the
algorithm can terminate.
10DCA (contd.)
The above algorithm terminates with the unique
solution to System (1), if the constraint system
is feasible.
11The Stressing Algorithm
- Repeat (n-1) times
- (a) for each vertex v in G
- if (v has an incoming negative edge)
- Stress(v)
- 2. If there still exists a negative cost arc in
the graph - declare G has a negative cost cycle
- else
- declare G does not have a negative cost
cycle.
12Stressing Algorithm (contd.)
The Stress Function
- 1. Find the most negative edge into v
- 2. Subtract this cost from all the edges into v.
- 3. Add this cost to all the edges out of v
13Analysis (Space)
Clearly, only register space is needed to
determine the minimum and for loop indexing.
14Analysis (Time)
- O(m.n) on a network with m arcs and n vertices.
15Visualization
B
1
H
-3
C
-2
G
A
-3
3
3
-1
5
-4
D
F
-7
I
-4
5
J
E
16Visualization (contd.)
G is stressed
A is stressed
B
1
H
0
C
-3
G
A
-3
3
3
0
5
-7
D
F
-7
I
-4
5
J
E
17Visualization (contd.)
B is stressed
J is stressed
B
H
-2
0
C
0
G
A
-6
3
3
0
5
0
D
F
-7
I
-4
-2
J
E
18Visualization (contd.)
C is stressed
I is stressed
B
H
0
0
C
0
G
A
-6
1
5
0
3
0
D
F
-7
I
-4
0
J
E
19Visualization (contd.)
D is stressed
B
H
0
0
C
0
G
A
1
1
-2
0
3
0
D
F
0
I
-4
0
J
E
20Visualization (contd.)
E is stressed, F cannot be stressed first round
is over
B
H
0
0
C
0
G
A
1
1
-2
0
3
0
D
F
-4
I
0
0
J
E
21Visualization (contd.)
Round 2 begin by stressing C
B
H
2
0
C
0
G
A
1
1
0
0
1
0
D
F
-4
I
0
0
J
E
22Visualization (contd.)
Finally the negative cycle is isolated as a
negative edge
B
H
2
0
C
0
G
A
1
1
0
0
1
0
D
F
-4
I
0
0
J
E
23Correctness
- Observation The Stressing Algorithm is precisely
the - Difference Constraint Approach with two
differences - The Stressing Algorithm terminates after exactly
- (n-1) rounds.
- (b) When a vertex is stressed, we use the most
negative - incoming edge as the pivot.
24Correctness (contd.)
Theorem Stressing preserves costs around a cycle.
H
-1
G
1
0
I
0
J
25Correctness (contd.)
Corollary Stressing does not create negative
cost cycles, if none existed in the first place.
Theorem If the graph does have a negative cost
cycle, the Stressing Algorithm declares that the
input graph has a negative cost cycle.
26Correctness (contd.)
- Theorem If the graph does not have a negative
cost cycle, there will not be any negative cost
edges in the input graph after (n-1) rounds.
Proof (sketch) Focus on the unique BFS of the
Difference Constraint system, which is a spanning
tree. Key Observation There is at least one
vertex which is never stressed at all. After each
round of stressing, one additional vertex is
never stressed again. (By induction)
27Differences between Bellman-Ford and Stressing
- Sourced versus sourceless
- Dynamic Programming versus Greedy
- Zero labeling space
28Producing the cycle
- Maintain a variable at each vertex.
- When a vertex is stressed store the
- label of the pivot edge!
- Total space used is O(n), which is
- strongly polynomial, unlike Bellman-Ford.
29Open Issues
- Implementation study
- Planar digraphs
- Parallelization
30The Beginning