gexf

package module
v0.0.0-...-3926dcc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2014 License: BSD-2-Clause Imports: 7 Imported by: 0

README

gexf: Go package of Graph Exchange XML Format

REFERENCE

http://gexf.net

Documentation

Index

Constants

View Source
const (
	Version    = "1.2"
	Namespace  = "http://www.gexf.net/1.2draft"
	TimeFormat = "2006-01-02+15:04"

	DefaultCreator = "Gexf Go Library " + Version
)
View Source
const (
	Directed        = EdgeType("directed")
	Undirected      = EdgeType("undirected")
	Mutual          = EdgeType("mutual")
	DefaultEdgeType = Directed
)
View Source
const (
	String        = IdType("string")
	Integer       = IdType("integer")
	DefaultIdType = String
)
View Source
const (
	Static           = GraphType("static")
	Dynamic          = GraphType("dynamic")
	DefaultGraphType = Static
)
View Source
const (
	ClassNode        = ClassType("node")
	ClassEdge        = ClassType("edge")
	DefaultClassType = ClassNode
)

Variables

This section is empty.

Functions

func FromGobFile

func FromGobFile(file string, e interface{}) error

func ToGobFile

func ToGobFile(file string, e interface{}) error

Types

type AttValue

type AttValue struct {
	For   string `xml:"for,attr"`
	Value string `xml:"value,attr"`
}

type AttValues

type AttValues struct {
	AttValue []AttValue `xml:"attvalue"`
}

func (*AttValues) Add

func (at *AttValues) Add(a AttValue)

type Attribute

type Attribute struct {
	Id      string `xml:"id,attr"`
	Type    string `xml:"type,attr"`
	Title   string `xml:"title,attr"`
	Default string `xml:",innerxml"`
}

type Attributes

type Attributes struct {
	Class     ClassType   `xml:"class,attr"`
	Attribute []Attribute `xml:"attribute"`
}

func (*Attributes) Add

func (at *Attributes) Add(a Attribute)

type ClassType

type ClassType string

type Edge

type Edge struct {
	Id     string  `xml:"id,attr"`
	Source string  `xml:"source,attr"`
	Target string  `xml:"target,attr"`
	Weight float64 `xml:"weight,attr"`
}

type EdgeType

type EdgeType string

func (EdgeType) String

func (t EdgeType) String() string

type Edges

type Edges struct {
	Edge  []Edge `xml:"edge"`
	Count int    `xml:"count,attr"`
}

func (*Edges) Add

func (es *Edges) Add(e Edge)

type Gexf

type Gexf struct {
	XMLName xml.Name
	Version string `xml:"version,attr"`
	Meta    Meta   `xml:"meta"`

	Graph Graph `xml:"graph"`
}

func New

func New() *Gexf

func Open

func Open(file string) (g *Gexf, err error)

func (*Gexf) AddAttribute

func (g *Gexf) AddAttribute(a Attribute)

func (*Gexf) AddAttributeToNode

func (g *Gexf) AddAttributeToNode(idx int, a AttValue)

func (*Gexf) AddEdge

func (g *Gexf) AddEdge(e Edge)

func (*Gexf) AddNode

func (g *Gexf) AddNode(n Node)

func (*Gexf) GetNodeAttVal

func (g *Gexf) GetNodeAttVal(nodeIdx int, attIdx int) (string, error)

func (*Gexf) Save

func (g *Gexf) Save(file string) error

func (*Gexf) SetNodeAttVal

func (g *Gexf) SetNodeAttVal(nodeIdx int, attIdx int, attValue string) error

type Graph

type Graph struct {
	Type     GraphType `xml:"type,attr"`
	IdType   IdType    `xml:"idtype,attr"`
	EdgeType EdgeType  `xml:"defaultedgetype,attr"`

	Attributes Attributes `xml:"attributes,omitempty"`
	Nodes      Nodes      `xml:"nodes"`
	Edges      Edges      `xml:"edges"`
}

type GraphType

type GraphType string

type IdType

type IdType string

type Meta

type Meta struct {
	LastModified string `xml:"lastmodifieddate,attr"`
	Creator      string `xml:"creator,omitempty"`
	Keywords     string `xml:"keywords,omitempty"`
	Description  string `xml:"description,omitempty"`
}

type Node

type Node struct {
	Id        string    `xml:"id,attr"`
	Label     string    `xml:"label,attr"`
	AttValues AttValues `xml:"attvalues"`
}

type Nodes

type Nodes struct {
	Node  []Node `xml:"node"`
	Count int    `xml:"count,attr"`
}

func (*Nodes) Add

func (ns *Nodes) Add(n Node)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL