export

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package export writes the library out as GraphML, JSON and BibTeX. M1.

No lock-in is a product commitment, not a feature: everything the tool knows must be extractable in a format something else can read. GraphML is the one that matters first, because the M1 acceptance test is a 500-node graph that opens cleanly in Gephi.

Every exporter has to survive a graph that is mostly stubs — works with an ID and no title. Filter them or label them, but never crash on them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphML

type GraphML struct {
	// contains filtered or unexported fields
}

GraphML writes a citation graph as GraphML (http://graphml.graphdrawing.org), the format Gephi, Cytoscape, yEd, NetworkX and igraph all read.

It streams: nodes and edges are written as they are handed over, so a library of any size exports in constant memory. Call WriteNode for every node, then WriteEdge for every edge, then Close. GraphML requires nodes and edges inside one <graph> element and does not require nodes first, but several readers resolve edges against nodes already seen, so nodes go first.

Edges point from the citing work to the cited one: an arrow means "cites", which is also the direction fil path calls lineage.

func NewGraphML

func NewGraphML(w io.Writer) *GraphML

NewGraphML writes the GraphML header to w and returns a writer for the graph's nodes and edges.

func (*GraphML) Close

func (g *GraphML) Close() error

Close ends the document and flushes it, returning the first error seen at any point in the write.

func (*GraphML) Counts

func (g *GraphML) Counts() (nodes, edges int)

Counts reports how many nodes and edges were written.

func (*GraphML) WriteEdge

func (g *GraphML) WriteEdge(from, to string)

WriteEdge writes one citation: from cites to.

func (*GraphML) WriteNode

func (g *GraphML) WriteNode(w *model.Work)

WriteNode writes one work. Absent values are left out rather than written as zero or empty: a stub has no year, and "year 0" would put it at the start of every timeline.

Jump to

Keyboard shortcuts

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