+7 -4 +/-2 browse
1 | diff --git a/encoding.go b/encoding.go |
2 | index bdc2597..e2ee25b 100644 |
3 | --- a/encoding.go |
4 | +++ b/encoding.go |
5 | @@ -28,7 +28,7 @@ type dotEncoder struct { |
6 | } |
7 | |
8 | func (d dotEncoder) Encode(w io.Writer) error { |
9 | - raw, err := dot.Marshal(d.graph, "", "", "", false) |
10 | + raw, err := dot.Marshal(d.graph, "", "", "") |
11 | if err != nil { |
12 | return err |
13 | } |
14 | diff --git a/types.go b/types.go |
15 | index c60b260..57c65da 100644 |
16 | --- a/types.go |
17 | +++ b/types.go |
18 | @@ -64,6 +64,8 @@ func (a Airport) ID() int64 { |
19 | return int64(h.Sum64()) |
20 | } |
21 | |
22 | + var _ graph.WeightedEdge = (*Route)(nil) |
23 | + |
24 | type Route struct { |
25 | to Airport |
26 | from Airport |
27 | @@ -74,9 +76,10 @@ func (r Route) String() string { |
28 | return fmt.Sprintf("%s->%s", r.from, r.to) |
29 | } |
30 | |
31 | - func (r Route) To() graph.Node { return r.to } |
32 | - func (r Route) From() graph.Node { return r.from } |
33 | - func (r Route) Weight() float64 { return r.weight } |
34 | + func (r Route) To() graph.Node { return r.to } |
35 | + func (r Route) From() graph.Node { return r.from } |
36 | + func (r Route) Weight() float64 { return r.weight } |
37 | + func (r Route) ReversedEdge() graph.Edge { return Route{to: r.from, from: r.to, weight: r.weight} } |
38 | |
39 | func SetWeight(r Route, weight float64) Route { |
40 | return Route{to: r.to, from: r.from, weight: weight} |