summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-02-21 15:41:54 -0500
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-02-21 15:41:54 -0500
commiteb30c23bb03579bf839189ab0d2ad172d5b07766 (patch)
tree332c7f409a98e5863bcaf27705f4527e05e85c19 /BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
parent99e79bca7c1fe3c43ca2ec67e36b8e323c5f7107 (diff)
Commenting of various things and minor refactoring
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java b/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
index 69e42e4..03bc0c2 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
@@ -13,6 +13,8 @@ import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BiPredicate;
+import bjc.utils.data.GenHolder;
+
/**
* A directed weighted graph, where the vertices have some arbitrary label
*
@@ -23,6 +25,9 @@ import java.util.function.BiPredicate;
*/
public class Graph<T> {
+ /**
+ * The backing representation of the graph
+ */
private final Map<T, Map<T, Integer>> graph;
/**
@@ -165,6 +170,11 @@ public class Graph<T> {
return minEdges;
}
+ /**
+ * Get the count of the vertices in this graph
+ *
+ * @return A count of the vertices in this graph
+ */
public int getVertexCount() {
return graph.size();
}
@@ -225,6 +235,13 @@ public class Graph<T> {
return aMap;
}
+ /**
+ * Create a graph from a list of edges
+ *
+ * @param edges
+ * The list of edges to build from
+ * @return A graph built from the provided edge-list
+ */
public static <E> Graph<E> fromEdgeList(List<Edge<E>> edges) {
Graph<E> g = new Graph<>();