gonumgonum.org/v1/gonum/graph/formats/cytoscapejs Index | Files

package cytoscapejs

import "gonum.org/v1/gonum/graph/formats/cytoscapejs"

Package cytoscapejs implements marshaling and unmarshaling of Cytoscape.js JSON documents.

See http://js.cytoscape.org/ for Cytoscape.js documentation.

Index

Types

type Edge

type Edge struct {
	Data       EdgeData    `json:"data"`
	Selected   bool        `json:"selected,omitempty"`
	Selectable bool        `json:"selectable,omitempty"`
	Classes    string      `json:"classes,omitempty"`
	Scratch    interface{} `json:"scratch,omitempty"`
}

Edge is a Cytoscape.js edge.

type EdgeData

type EdgeData struct {
	ID         string
	Source     string
	Target     string
	Attributes map[string]interface{}
}

EdgeData is a graph edge's data container.

func (*EdgeData) MarshalJSON

func (e *EdgeData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*EdgeData) UnmarshalJSON

func (e *EdgeData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ElemData

type ElemData struct {
	ID         string
	Source     string
	Target     string
	Parent     string
	Attributes map[string]interface{}
}

ElemData is a graph element's data container.

func (*ElemData) MarshalJSON

func (e *ElemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*ElemData) UnmarshalJSON

func (e *ElemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ElemType

type ElemType int

ElemType describes an Element type.

const (
	InvalidElement ElemType = iota - 1
	NodeElement
	EdgeElement
)

type Element

type Element struct {
	Group            string      `json:"group,omitempty"`
	Data             ElemData    `json:"data"`
	Position         *Position   `json:"position,omitempty"`
	RenderedPosition *Position   `json:"renderedPosition,omitempty"`
	Selected         bool        `json:"selected,omitempty"`
	Selectable       bool        `json:"selectable,omitempty"`
	Locked           bool        `json:"locked,omitempty"`
	Grabbable        bool        `json:"grabbable,omitempty"`
	Classes          string      `json:"classes,omitempty"`
	Scratch          interface{} `json:"scratch,omitempty"`
}

Element is a mixed graph element.

func (Element) Type

func (e Element) Type() (ElemType, error)

Type returns the element type of the receiver. It returns an error if the Element Group is invalid or does not match the Element Data, or if the Element Data is an incomplete edge.

type Elements

type Elements struct {
	Nodes []Node `json:"nodes"`
	Edges []Edge `json:"edges"`
}

Elements contains the nodes and edges of a GraphNodeEdge.

type GraphElem

type GraphElem struct {
	Elements []Element     `json:"elements"`
	Layout   interface{}   `json:"layout,omitempty"`
	Style    []interface{} `json:"style,omitempty"`
}

GraphElem is a Cytoscape.js graph with mixed graph elements.

type GraphNodeEdge

type GraphNodeEdge struct {
	Elements Elements      `json:"elements"`
	Layout   interface{}   `json:"layout,omitempty"`
	Style    []interface{} `json:"style,omitempty"`
}

GraphNodeEdge is a Cytoscape.js graph with separated nodes and edges.

type Node

type Node struct {
	Data             NodeData    `json:"data"`
	Position         *Position   `json:"position,omitempty"`
	RenderedPosition *Position   `json:"renderedPosition,omitempty"`
	Selected         bool        `json:"selected,omitempty"`
	Selectable       bool        `json:"selectable,omitempty"`
	Locked           bool        `json:"locked,omitempty"`
	Grabbable        bool        `json:"grabbable,omitempty"`
	Classes          string      `json:"classes,omitempty"`
	Scratch          interface{} `json:"scratch,omitempty"`
}

Node is a Cytoscape.js node.

type NodeData

type NodeData struct {
	ID         string
	Parent     string
	Attributes map[string]interface{}
}

NodeData is a graph node's data container.

func (*NodeData) MarshalJSON

func (n *NodeData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*NodeData) UnmarshalJSON

func (n *NodeData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Position

type Position struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Position is a node position.

Source Files

cytoscapejs.go

Version
v0.15.1 (latest)
Published
Aug 16, 2024
Platform
linux/amd64
Imports
3 packages
Last checked
2 days ago

Tools for package owners.