/
graph.go
42 lines (34 loc) · 1.02 KB
/
graph.go
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
/*
This file defines fundamental graph structures that should
be brokered by the graph interface.
*/
package dvid
// ElementProperties is a set of strings corresponding to properties
// stored at an graph edge or vertex (it might make sense to store some
// properties with the vertex or edge)
type ElementProperties map[string]struct{}
// VertexID is a 64 bit label ID for vertices in the graph
type VertexID uint64
const VertexIDSize = 8
// smaller ID should be first
type VertexPairID struct {
Vertex1 VertexID
Vertex2 VertexID
}
// GraphElement defines fundamental data common to both vertices and edges
type GraphElement struct {
Properties ElementProperties
Weight float64
}
// GraphVertex defines a vertex in a graph; a vertex should have a unique id
type GraphVertex struct {
*GraphElement
Id VertexID
Vertices []VertexID
}
// GraphEdge defines an edge in a graph; if a directed edge is desired it
// must be specified as an edge property
type GraphEdge struct {
*GraphElement
Vertexpair VertexPairID
}