diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-27 16:43:17 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-27 16:43:22 +0200 |
commit | 8535a9ca92539bf12ec00cac7a4e47be604f0283 (patch) | |
tree | 7a1fb082d5218e18a0186d97a8ed1f7dd87fd41f /src/main/java/com.example.portfolio3/com/example/portfolio3/EdgeGraph.java | |
parent | d104247b8bcdb2a38b680ac54e7ceb2bba155c0e (diff) |
simplify path structure
Diffstat (limited to 'src/main/java/com.example.portfolio3/com/example/portfolio3/EdgeGraph.java')
-rw-r--r-- | src/main/java/com.example.portfolio3/com/example/portfolio3/EdgeGraph.java | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/main/java/com.example.portfolio3/com/example/portfolio3/EdgeGraph.java b/src/main/java/com.example.portfolio3/com/example/portfolio3/EdgeGraph.java deleted file mode 100644 index ae9cbe9..0000000 --- a/src/main/java/com.example.portfolio3/com/example/portfolio3/EdgeGraph.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.portfolio3; - -// origin: <https://moodle.ruc.dk/course/section.php?id=211877> - -/// EdgeGraph - One big set of all edges in the graph -class EdgeGraph extends AbstractGraph { - - /// foo - EdgeGraph() {} - - /// foo - Set<Edge> edges=new HashSet<>(); - - /// foo - public void insertEdge(Vertex v1,Vertex v2,int w){ - edges.add(new Edge(v1,v2,w)); - } - - /// foo - public Collection<Edge> edges(){return edges;} - - /// foo - public Collection<Edge> outEdge(Vertex v){ - ArrayList<Edge> outEdge=new ArrayList<>(); - for(Edge e:edges)if(e.from()==v)outEdge.add(e); - return outEdge; - } - - /// foo - public Integer getWeight(Vertex v1,Vertex v2){ - // linear in number of edges in the graph - for(Edge e:edges){ - if(e.from()==v1 && e.to()==v2)return e.weight(); - } - return null; - } -} |