summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/graph
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/main/java/bjc/utils/graph')
-rw-r--r--base/src/main/java/bjc/utils/graph/AdjacencyMap.java1
-rw-r--r--base/src/main/java/bjc/utils/graph/Edge.java1
-rw-r--r--base/src/main/java/bjc/utils/graph/Graph.java12
-rw-r--r--base/src/main/java/bjc/utils/graph/Graphs.java10
4 files changed, 14 insertions, 10 deletions
diff --git a/base/src/main/java/bjc/utils/graph/AdjacencyMap.java b/base/src/main/java/bjc/utils/graph/AdjacencyMap.java
index 04fe4c8..f03fb69 100644
--- a/base/src/main/java/bjc/utils/graph/AdjacencyMap.java
+++ b/base/src/main/java/bjc/utils/graph/AdjacencyMap.java
@@ -21,6 +21,7 @@ import bjc.utils.funcutils.FuncUtils;
*
* @param <T>
* The type of the nodes in the graph
+ * @param <W> The type of the weights
*/
public class AdjacencyMap<T, W> {
/**
diff --git a/base/src/main/java/bjc/utils/graph/Edge.java b/base/src/main/java/bjc/utils/graph/Edge.java
index 5b0eba3..bffa0a1 100644
--- a/base/src/main/java/bjc/utils/graph/Edge.java
+++ b/base/src/main/java/bjc/utils/graph/Edge.java
@@ -8,6 +8,7 @@ import java.util.Objects;
* @author ben
*
* @param <T> The type of the nodes in the graph.
+ * @param <W> The type of the weight
*/
public class Edge<T, W> {
/* The distance from initial to terminal node. */
diff --git a/base/src/main/java/bjc/utils/graph/Graph.java b/base/src/main/java/bjc/utils/graph/Graph.java
index 81653fc..a007698 100644
--- a/base/src/main/java/bjc/utils/graph/Graph.java
+++ b/base/src/main/java/bjc/utils/graph/Graph.java
@@ -1,20 +1,11 @@
package bjc.utils.graph;
-import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.NoSuchElementException;
-import java.util.PriorityQueue;
-import java.util.Queue;
-import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BiPredicate;
-import bjc.data.Holder;
-import bjc.data.Identity;
-import bjc.funcdata.FunctionalMap;
-import bjc.funcdata.ListEx;
-import bjc.funcdata.MapEx;
+import bjc.funcdata.*;
/**
* A directed weighted graph, where the vertices have some arbitrary label.
@@ -23,6 +14,7 @@ import bjc.funcdata.MapEx;
*
* @param <VertexLabel>
* The label for vertices.
+ * @param <EdgeLabel> The label for edges
*/
public class Graph<VertexLabel, EdgeLabel> {
/**
diff --git a/base/src/main/java/bjc/utils/graph/Graphs.java b/base/src/main/java/bjc/utils/graph/Graphs.java
index 2844a68..f504b55 100644
--- a/base/src/main/java/bjc/utils/graph/Graphs.java
+++ b/base/src/main/java/bjc/utils/graph/Graphs.java
@@ -5,11 +5,21 @@ import java.util.*;
import bjc.data.Holder;
import bjc.data.Identity;
+/**
+ * General graph utilities
+ * @author bjcul
+ *
+ */
public class Graphs {
/**
* Uses Prim's algorithm to calculate a MST for the graph.
*
* If the graph is non-connected, this will lead to unpredictable results.
+ *
+ * @param grap The graph to calculate MST for
+ * @param comp The comparator for the edges
+ * @param <T> The vertex type
+ * @param <L> The edge type
*
* @return A list of edges that constitute the MST.
*/