formats

package
v2.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package formats defines the serialization formats which can be used for network graph persistence

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteCytoscapeJSON

func WriteCytoscapeJSON(w io.Writer, n *network.Network) error

WriteCytoscapeJSON is to write this network graph using Cytoscape JSON encoding. Generated JSON file can be used for visualization with Cytoscape application https://cytoscape.org or as input to the Cytoscape JavaScript library https://js.cytoscape.org This will use goNEAT default style for the graph. If you want to apply different style you can use WriteCytoscapeJSONWithStyle and provide your style as a parameter.

func WriteCytoscapeJSONWithStyle

func WriteCytoscapeJSONWithStyle(w io.Writer, n *network.Network, style *CytoscapeStyleOptions) error

WriteCytoscapeJSONWithStyle allows writing of this network graph using Cytoscape JSON encoding. Additionally, it is possible to provide style to be used for rendering of the graph. For more details about style, see https://js.cytoscape.org/#getting-started/specifying-basic-options

func WriteDOT

func WriteDOT(w io.Writer, n *network.Network) error

WriteDOT is to write provided network graph using the GraphViz DOT encoding. See DOT Guide: https://www.graphviz.org/pdf/dotguide.pdf

Types

type CytoscapeStyleOptions

type CytoscapeStyleOptions struct {
	// Style the style to be applied to the graph elements: nodes and edges.
	Style []ElementStyle
	// Layout the layout used for the graph visualization. See https://js.cytoscape.org/#layouts
	Layout interface{}
}

CytoscapeStyleOptions is to hold style options to be appended to the graph elements definition when serializing to Cytoscape JSON. Form more details, see https://js.cytoscape.org/#getting-started/specifying-basic-options

type ElementStyle

type ElementStyle struct {
	//// Selector is to select element to apply style: node or edge
	Selector string `json:"selector"`
	//// Style the map with style options to be applied
	Style map[string]interface{} `json:"style"`
}

ElementStyle is to define style of particular element: edge or node. See https://js.cytoscape.org/#style

Jump to

Keyboard shortcuts

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