Color every node using DFS as "black" or "white".
Color the root black, make it the current node, and do the following:
For every node connected to the current node
If node is uncolored
Color it with the opposite color of the current node
Recursively do a DFS on it
Else If node is colored ...
Search found 35 matches
- Tue Sep 05, 2006 3:53 am
- Forum: Algorithms
- Topic: graph problems
- Replies: 6
- Views: 3305
- Sat Sep 02, 2006 8:03 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11081 - Strings
- Replies: 35
- Views: 25655
- Fri Sep 01, 2006 7:13 pm
- Forum: Algorithms
- Topic: graph problems
- Replies: 6
- Views: 3305
- Thu Aug 31, 2006 7:00 pm
- Forum: Algorithms
- Topic: problem from us open 2005
- Replies: 1
- Views: 1576
- Thu Aug 31, 2006 2:54 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10011 - Where Can You Hide?
- Replies: 58
- Views: 19098
- Wed Aug 30, 2006 6:21 pm
- Forum: Algorithms
- Topic: MinCost MaxFlow code
- Replies: 20
- Views: 18667
- Tue Aug 29, 2006 6:11 am
- Forum: Volume 100 (10000-10099)
- Topic: 10011 - Where Can You Hide?
- Replies: 58
- Views: 19098
- Mon Aug 28, 2006 10:45 am
- Forum: Volume 109 (10900-10999)
- Topic: 10949 - Kids in a Grid
- Replies: 30
- Views: 17101
The min(m,n-p) bound comes from the fact that there are most min(m,n-p) dominant matches per contour.
Unfortunately, most papers I have found don't mention how to get min(m,n-p) time per contour - they just state it as fact. (Getting O(m) is really easy, though). And I don't know where you can find ...
Unfortunately, most papers I have found don't mention how to get min(m,n-p) time per contour - they just state it as fact. (Getting O(m) is really easy, though). And I don't know where you can find ...
- Fri Aug 25, 2006 3:43 am
- Forum: Algorithms
- Topic: MinCost MaxFlow code
- Replies: 20
- Views: 18667
(1) Finding the negative cycle is a very short extension of Bellman-Ford. This isn't really efficient, though.
(2) I haven't seen Igor's code yet, but I'm suspecting he is using the Cheapest Augmenting Path algorithm. The basic idea is to weight each node with a "potential", and for each edge (u,v ...
(2) I haven't seen Igor's code yet, but I'm suspecting he is using the Cheapest Augmenting Path algorithm. The basic idea is to weight each node with a "potential", and for each edge (u,v ...
- Wed Aug 23, 2006 4:51 am
- Forum: Volume 100 (10000-10099)
- Topic: 10005 - Packing polygons
- Replies: 49
- Views: 23022
- Wed Aug 23, 2006 4:43 am
- Forum: Volume 100 (10000-10099)
- Topic: 10040 - Ouroboros Snake
- Replies: 20
- Views: 6785
- Mon Aug 14, 2006 9:03 pm
- Forum: Algorithms
- Topic: Coloring a Partially Colored Graph
- Replies: 1
- Views: 1553
- Sun Aug 13, 2006 2:22 am
- Forum: Volume 110 (11000-11099)
- Topic: 11065 - A Gentlemen's Agreement
- Replies: 19
- Views: 10322
- Sun Aug 13, 2006 2:11 am
- Forum: Volume 110 (11000-11099)
- Topic: 11065 - A Gentlemen's Agreement
- Replies: 19
- Views: 10322
- Sat Aug 12, 2006 3:25 pm
- Forum: ACM ICPC Archive Board
- Topic: how to solve this problem?
- Replies: 2
- Views: 3260