encoding.go 922 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright ©2017 The Gonum Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package encoding
  5. import "gonum.org/v1/gonum/graph"
  6. // Builder is a graph that can have user-defined nodes and edges added.
  7. type Builder interface {
  8. graph.Graph
  9. graph.Builder
  10. }
  11. // MultiBuilder is a graph that can have user-defined nodes and edges added.
  12. type MultiBuilder interface {
  13. graph.Multigraph
  14. graph.MultigraphBuilder
  15. }
  16. // AttributeSetter is implemented by types that can set an encoded graph
  17. // attribute.
  18. type AttributeSetter interface {
  19. SetAttribute(Attribute) error
  20. }
  21. // Attributer defines graph.Node or graph.Edge values that can
  22. // specify graph attributes.
  23. type Attributer interface {
  24. Attributes() []Attribute
  25. }
  26. // Attribute is an encoded key value attribute pair use in graph encoding.
  27. type Attribute struct {
  28. Key, Value string
  29. }