Skip to content

@graphty/cytoscape-extensions / io / ExportOptions

Interface: ExportOptions ​

Defined in: cytoscape-extensions/src/io.ts:61

Options of graphtyExport: graph-io's export options for the format, plus whether to write a directed graph. sanitizeIds defaults to "mangle" here (graph-io's default is "error"): GML and CX2 take only integer ids, so when a node id is not a plain non-negative integer ("a", "-1", "007") the nodes are numbered and the original kept in an attribute graphtyImport restores. When every id is one ("0", "17"), the ids are written as they are, and "error" accepts them too. JSON is written as Cytoscape JSON (dialect: "cytoscape", the shape cy.json() and cy.add() use), which keeps edge ids, compound parents and positions; pass dialect: "node-link" for the NetworkX shape.

Extends ​

  • ExportGraphOptions

Indexable ​

[formatOption: string]: unknown

Format-specific options, passed to the exporter as they are.

Properties ​

directed? ​

readonly optional directed?: boolean

Defined in: cytoscape-extensions/src/io.ts:63

Write the graph as directed. Default false.


onLoss? ​

readonly optional onLoss?: (notes) => void

Defined in: cytoscape-extensions/src/io.ts:68

Called before writing with what the format cannot hold (positions in GraphML, lists and objects in DOT, ...), one note per column and kind of loss; not called when nothing is lost. Without it a loss is silent.

Parameters ​

notes ​

readonly LossNote[]

Returns ​

void


onMixedDirection? ​

optional onMixedDirection?: "directed" | "error" | "undirected"

Defined in: graph-io/dist/src/types.d.ts:381

What a format with one direction per file does with a graph that has both directed and undirected edges: "error" throws (E_DIRECTED), "directed" writes every edge as directed (an undirected edge once, as one directed edge), "undirected" writes the whole graph undirected. A format that keeps each edge's own direction (GraphML, GEXF, CSV, Pajek, XGMML, Cytoscape sessions, and the JGF and graphology JSON dialects) ignores it and writes both kinds; to make such a graph all one direction, read it with the import option onMixedDirection.

Default Value ​

ts
"error"

Inherited from ​

ExportGraphOptions.onMixedDirection


sanitizeIds? ​

optional sanitizeIds?: "error" | "mangle"

Defined in: graph-io/dist/src/types.d.ts:371

What to do with node ids the format cannot hold. "error": the export throws (E_INVALID_ID) and no node is renamed. "mangle": such ids are rewritten and the originals are written to the file too, so an import with restoreMangledIds (on by default) reads the original ids back. Pajek is the exception: it always numbers nodes 1 to N and keeps the old ids as labels.

Default Value ​

ts
"error"

Inherited from ​

ExportGraphOptions.sanitizeIds