-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.go
More file actions
38 lines (30 loc) · 704 Bytes
/
Copy pathgraph.go
File metadata and controls
38 lines (30 loc) · 704 Bytes
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
package graph
import (
"graph/edge"
"graph/vertex"
)
type Graph interface {
GetVerticesCount() int
GetEdgesCount() int
GetVertices() map[string]vertex.Vertex
GetEdges() map[string]edge.Edge
}
type graph struct {
vertices map[string]vertex.Vertex
edges map[string]edge.Edge
}
func NewGraph(vertices map[string]vertex.Vertex, edges map[string]edge.Edge) Graph {
return &graph{vertices: vertices, edges: edges}
}
func (g *graph) GetVerticesCount() int {
return len(g.vertices)
}
func (g *graph) GetEdgesCount() int {
return len(g.edges)
}
func (g *graph) GetVertices() map[string]vertex.Vertex {
return g.vertices
}
func (g *graph) GetEdges() map[string]edge.Edge {
return g.edges
}