-
Notifications
You must be signed in to change notification settings - Fork 1
/
type.go
88 lines (69 loc) · 1.74 KB
/
type.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
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 2014, Hǎiliàng Wáng. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gexf
import (
"encoding/xml"
)
const (
Version = "1.2"
Namespace = "http://www.gexf.net/1.2draft"
TimeFormat = "2006-01-02+15:04"
DefaultCreator = "Gexf Go Library " + Version
)
type Gexf struct {
XMLName xml.Name
Version string `xml:"version,attr"`
Meta Meta `xml:"meta"`
Graph Graph `xml:"graph"`
}
type Graph struct {
Type GraphType `xml:"type,attr"`
IdType IdType `xml:"idtype,attr"`
EdgeType EdgeType `xml:"defaultedgetype,attr"`
Nodes Nodes `xml:"nodes"`
Edges Edges `xml:"edges"`
}
type EdgeType string
const (
Directed = EdgeType("directed")
Undirected = EdgeType("undirected")
Mutual = EdgeType("mutual")
DefaultEdgeType = Directed
)
type IdType string
const (
String = IdType("string")
Integer = IdType("integer")
DefaultIdType = String
)
type GraphType string
const (
Static = GraphType("static")
Dynamic = GraphType("dynamic")
DefaultGraphType = Static
)
type Meta struct {
LastModified string `xml:"lastmodifieddate,attr"`
Creator string `xml:"creator,omitempty"`
Keywords string `xml:"keywords,omitempty"`
Description string `xml:"description,omitempty"`
}
type Nodes struct {
Node []Node `xml:"node"`
Count int `xml:"count,attr"`
}
type Node struct {
Id string `xml:"id,attr"`
Label string `xml:"label,attr"`
}
type Edges struct {
Edge []Edge `xml:"edge"`
Count int `xml:"count,attr"`
}
type Edge struct {
Id string `xml:"id,attr"`
Source string `xml:"source,attr"`
Target string `xml:"target,attr"`
Weight float64 `xml:"weight,attr"`
}