summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
diff options
context:
space:
mode:
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.java42
1 files changed, 21 insertions, 21 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 fbaf3f6..0574325 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/graph/Graph.java
@@ -26,6 +26,27 @@ import bjc.utils.funcdata.IFunctionalMap;
*/
public class Graph<T> {
/**
+ * Create a graph from a list of edges
+ *
+ * @param <E>
+ * The type of data stored in the 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<>();
+
+ edges.forEach(edge -> {
+ g.addEdge(edge.getSource(), edge.getTarget(),
+ edge.getDistance(), true);
+ });
+
+ return g;
+ }
+
+ /**
* The backing representation of the graph
*/
private final IFunctionalMap<T, IFunctionalMap<T, Integer>> backingGraph;
@@ -265,25 +286,4 @@ public class Graph<T> {
return adjacencyMap;
}
-
- /**
- * Create a graph from a list of edges
- *
- * @param <E>
- * The type of data stored in the 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<>();
-
- edges.forEach(edge -> {
- g.addEdge(edge.getSource(), edge.getTarget(),
- edge.getDistance(), true);
- });
-
- return g;
- }
}