From 2cb46e054064949b793e67cffe3d780a9440c8e2 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 16 Mar 2023 00:18:38 -0700 Subject: [PATCH] explanatory readme --- README.md | 57 ++++++------------------------------------------------- 1 file changed, 6 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 6b728a197..d7a917212 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,9 @@ -# Description -This provides the `ConnGraph` class, which implements an undirected graph with -dynamic connectivity. It supports adding and removing edges and determining -whether two vertices are connected - whether there is a path between them. -Adding and removing edges take O(log2N) amortized time with high -probability, while checking whether two vertices are connected takes O(log N) -time with high probability. +Original readme --> https://github.com/btrekkie/dynamic-connectivity/ -# Features -* Efficiently add and remove edges and determine whether vertices are connected. -* A vertex can appear in multiple graphs, with a different set of adjacent - vertices in each graph. -* `ConnGraph` supports arbitrary vertex augmentation. Given a vertex V, - `ConnGraph` can quickly report the result of combining the augmentations of - all of the vertices in the connected component containing V, using a combining - function provided to the constructor. For example, if a `ConnGraph` represents - a game map, then given the location of the player, we can quickly determine - the amount of gold the player can access, or the strongest monster that can - reach him. Retrieving the combined augmentation for a connected component - takes O(log N) time with high probability. -* Compatible with Java 7.0 and above. +I am experimenting with using dynamic connectivity to help with Baritone builder 2 -# Limitations -* `ConnGraph` does not directly support augmenting edges. However, this can be - accomplished by imputing each edge's augmentation to an adjacent vertex. For - example, if each edge contains a certain amount of gold, then we can augment - each vertex with the amount of gold in the adjacent edges. We can then - calculate the amount of gold in a connected component by retrieving the - component's augmentation and dividing by two. A more general approach would be - to store the edges adjacent to each vertex in an augmented self-balancing - binary search tree (see - [RedBlackNode](https://github.com/btrekkie/RedBlackNode)), and to use this to - assign an augmentation to each vertex. -* Careful attention has been paid to the asymptotic running time of each method. - However, beyond this, no special effort has been made to optimize performance. - (A big obstacle to optimizing `ConnGraph` is a lack of access to samples from - real-world usage.) +https://en.wikipedia.org/wiki/Dynamic_connectivity -# Example usage -```java -ConnGraph graph = new ConnGraph(); -ConnVertex vertex1 = new ConnVertex(); -ConnVertex vertex2 = new ConnVertex(); -ConnVertex vertex3 = new ConnVertex(); -graph.addEdge(vertex1, vertex2); -graph.addEdge(vertex2, vertex3); -graph.connected(vertex1, vertex3); // Returns true -graph.removeEdge(vertex1, vertex2); -graph.connected(vertex1, vertex3); // Returns false -``` - -# Documentation -See for API -documentation. +If the experiments in this repo go well, I want to integrate it +into https://github.com/cabaletta/baritone/tree/builder-2/src/main/java/baritone/builder (i think MIT is +compatible with LGPL so this is ok) \ No newline at end of file