gonum: gonum.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

Package Files

cytoscapejs.go

type Edge Uses

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 Uses

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

EdgeData is a graph edge's data container.

func (*EdgeData) MarshalJSON Uses

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

MarshalJSON implements the json.Marshaler interface.

func (*EdgeData) UnmarshalJSON Uses

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

UnmarshalJSON implements the json.Unmarshaler interface.

type ElemData Uses

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 Uses

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

MarshalJSON implements the json.Marshaler interface.

func (*ElemData) UnmarshalJSON Uses

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

UnmarshalJSON implements the json.Unmarshaler interface.

type ElemType Uses

type ElemType int

ElemType describes an Element type.

const (
    InvalidElement ElemType = iota - 1
    NodeElement
    EdgeElement
)

type Element Uses

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 Uses

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 Elelement Data is an incomplete edge.

type Elements Uses

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

Elements contains the nodes and edges of a GraphNodeEdge.

type GraphElem Uses

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 Uses

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 Uses

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 Uses

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

NodeData is a graph node's data container.

func (*NodeData) MarshalJSON Uses

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

MarshalJSON implements the json.Marshaler interface.

func (*NodeData) UnmarshalJSON Uses

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

UnmarshalJSON implements the json.Unmarshaler interface.

type Position Uses

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

Position is a node position.

Package cytoscapejs imports 3 packages (graph). Updated 2019-01-30. Refresh now. Tools for package owners.