From 3eda7a57e835a1f87ecc1f32d4ffee647ec45e09 Mon Sep 17 00:00:00 2001 From: William Jacobs Date: Tue, 2 Aug 2022 19:27:45 -0400 Subject: [PATCH] Added assessment of ancestor pointers to optimization_ideas.txt This adds my assessment of the performance of the ancestor pointers optimization in practice to optimization_ideas.txt. --- optimization_ideas.txt | 5 +++-- .../java/com/github/btrekkie/connectivity/ConnGraph.java | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/optimization_ideas.txt b/optimization_ideas.txt index aa8255ac9..6feb84b0d 100644 --- a/optimization_ideas.txt +++ b/optimization_ideas.txt @@ -27,8 +27,9 @@ Thoughts concerning optimization: a node's parent, we have to change the pointers for all of the descendants that are less than k levels below the node - up to 2^k - 1 nodes. Since there are O(log N) parent pointer changes per update, and updates already take - O(log^2 N) amortized time, we can afford a k value of up to lg lg N + c (but - interestingly, not O(log log N)). + O(log^2 N) amortized time, we can afford a k value of up to lg lg N + O(1) + (but interestingly, not O(log log N)). However, I think this would be + significantly slower than a B-tree in practice. - If I don't implement the B-tree optimization, there are a couple of small optimizations I could try. First, I could move the field EulerTourNode.augmentationFunc to EulerTourVertex, in order to save a little diff --git a/src/main/java/com/github/btrekkie/connectivity/ConnGraph.java b/src/main/java/com/github/btrekkie/connectivity/ConnGraph.java index 5b9aa2ea1..545760892 100644 --- a/src/main/java/com/github/btrekkie/connectivity/ConnGraph.java +++ b/src/main/java/com/github/btrekkie/connectivity/ConnGraph.java @@ -39,8 +39,8 @@ import java.util.Map; * take O(log N) time rather than O(log N / log log N) time. * * This implementation is actually based on a slightly modified description of the data structure given in - * http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-851-advanced-data-structures-spring-2012/lecture-videos/session-20-dynamic-graphs-ii/ . - * The description in the video differs from the data structure in the paper in that the levels are numbered in reverse + * https://ocw.mit.edu/courses/6-851-advanced-data-structures-spring-2012/resources/session-20-dynamic-graphs-ii/ . The + * description in the video differs from the data structure in the paper in that the levels are numbered in reverse * order, the constraint on tree sizes is different, and the augmentation uses booleans in place of edges. In addition, * the video defines subgraphs G_i. The change in the constraint on tree sizes is beneficial because it makes it easier * to delete vertices.