diff --git a/gexf.go b/gexf.go index 880dade..124d4c7 100644 --- a/gexf.go +++ b/gexf.go @@ -65,8 +65,8 @@ type Graph struct { DefEdge EdgeType `xml:"defaultedgetype,attr,omitempty"` Attrs []ClassAttrs `xml:"attributes,omitempty"` - Nodes *[]Node `xml:"nodes>node,omitempty"` - Edges *[]Edge `xml:"edges>edge,omitempty"` + Nodes []Node `xml:"nodes>node,omitempty"` + Edges []Edge `xml:"edges>edge,omitempty"` } type EdgeType int @@ -169,12 +169,12 @@ type Attr struct { } type Node struct { - ID string `xml:"id,attr"` - Label string `xml:"label,attr,omitempty"` - Attrs *[]AttrVal `xml:"attvalues>attvalue,omiempty"` - Size *Size `xml:"http://www.gexf.net/1.2draft/viz size,omitempty"` - Pos *Pos `xml:"http://www.gexf.net/1.2draft/viz position,omitempty"` - Color *Color `xml:"http://www.gexf.net/1.2draft/viz color,omitempty"` + ID string `xml:"id,attr"` + Label string `xml:"label,attr,omitempty"` + Attrs []AttrVal `xml:"attvalues>attvalue,omiempty"` + Size *Size `xml:"http://www.gexf.net/1.2draft/viz size,omitempty"` + Pos *Pos `xml:"http://www.gexf.net/1.2draft/viz position,omitempty"` + Color *Color `xml:"http://www.gexf.net/1.2draft/viz color,omitempty"` } type Size struct { @@ -199,11 +199,11 @@ type AttrVal struct { } type Edge struct { - ID string `xml:"id,attr"` - Label string `xml:"label,attr,omitempty"` - Type EdgeType `xml:"type,attr,omitempty"` - Source string `xml:"source,attr"` - Target string `xml:"target,attr"` - Weight float64 `xml:"weight,attr,omitempty"` - Attrs *[]AttrVal `xml:"attvalues>attvalue,omiempty"` + ID string `xml:"id,attr"` + Label string `xml:"label,attr,omitempty"` + Type EdgeType `xml:"type,attr,omitempty"` + Source string `xml:"source,attr"` + Target string `xml:"target,attr"` + Weight float64 `xml:"weight,attr,omitempty"` + Attrs []AttrVal `xml:"attvalues>attvalue,omiempty"` } diff --git a/gexf_test.go b/gexf_test.go index 419e324..dbdd190 100644 --- a/gexf_test.go +++ b/gexf_test.go @@ -36,11 +36,17 @@ func TestHelloWorld(t *testing.T) { - - + + + + + + - + + + ` @@ -53,7 +59,7 @@ func TestHelloWorld(t *testing.T) { doc.Graph = Graph{ Mode: Static, DefEdge: Directed, - Nodes: &[]Node{ + Nodes: []Node{ { ID: "0", Label: "Hello", @@ -63,7 +69,7 @@ func TestHelloWorld(t *testing.T) { Label: "World", }, }, - Edges: &[]Edge{ + Edges: []Edge{ { ID: "0", Source: "0", @@ -102,6 +108,7 @@ func TestAttributes(t *testing.T) { + ` doc := New() @@ -135,11 +142,11 @@ func TestAttributes(t *testing.T) { }, }, }, - Nodes: &[]Node{ + Nodes: []Node{ { ID: "0", Label: "Gephi", - Attrs: &[]AttrVal{ + Attrs: []AttrVal{ { For: "0", Value: "http://gephi.org", @@ -153,7 +160,7 @@ func TestAttributes(t *testing.T) { { ID: "1", Label: "Webatlas", - Attrs: &[]AttrVal{ + Attrs: []AttrVal{ { For: "1", Value: "2", @@ -178,9 +185,11 @@ func TestViz(t *testing.T) { + + ` doc := New() @@ -192,7 +201,7 @@ func TestViz(t *testing.T) { doc.Graph = Graph{ Mode: Static, DefEdge: Directed, - Nodes: &[]Node{ + Nodes: []Node{ { ID: "0", Label: "Hello",