-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConcreteEdgesGraph.java
88 lines (66 loc) · 2 KB
/
ConcreteEdgesGraph.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* Copyright (c) 2015-2016 MIT 6.005 course staff, all rights reserved.
* Redistribution of original or derived work requires permission of course staff.
*/
package graph;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* An implementation of Graph.
*
* <p>PS2 instructions: you MUST use the provided rep.
*/
public class ConcreteEdgesGraph implements Graph<String> {
private final Set<String> vertices = new HashSet<>();
private final List<Edge> edges = new ArrayList<>();
// Abstraction function:
// TODO
// Representation invariant:
// TODO
// Safety from rep exposure:
// TODO
// TODO constructor
// TODO checkRep
@Override public boolean add(String vertex) {
throw new RuntimeException("not implemented");
}
@Override public int set(String source, String target, int weight) {
throw new RuntimeException("not implemented");
}
@Override public boolean remove(String vertex) {
throw new RuntimeException("not implemented");
}
@Override public Set<String> vertices() {
throw new RuntimeException("not implemented");
}
@Override public Map<String, Integer> sources(String target) {
throw new RuntimeException("not implemented");
}
@Override public Map<String, Integer> targets(String source) {
throw new RuntimeException("not implemented");
}
// TODO toString()
}
/**
* TODO specification
* Immutable.
* This class is internal to the rep of ConcreteEdgesGraph.
*
* <p>PS2 instructions: the specification and implementation of this class is
* up to you.
*/
class Edge {
// TODO fields
// Abstraction function:
// TODO
// Representation invariant:
// TODO
// Safety from rep exposure:
// TODO
// TODO constructor
// TODO checkRep
// TODO methods
// TODO toString()
}