Import and export#

Import and export of sequence databases, pattern sets and graphs.

object

formats

SequenceDatabase

SPMF (-1/-2, @ITEM labels, <t> timestamps, utilities ignored), CSV event logs, XES, pandas, pm4py

PatternSet

SPMF output (#SUP, #SID), CSV, JSON, Excel

graphs

GEXF (Gephi, with positions, colors, sizes), GraphML, GML, node-link JSON, Cytoscape JSON (with positions), Graphviz DOT, Pajek, CSV/Excel node and edge tables, igraph

SPMF, CSV, JSON, XES, GEXF, GraphML, GML, Cytoscape, DOT, Pajek, Excel, igraph.

Functions#

from_igraph(g)

Convert a python-igraph graph back to networkx (name becomes the node key).

read_graph(path[, format])

Read a graph written by write_graph() (GEXF, GraphML, GML, JSON, Cytoscape JSON, CSV).

read_patterns(path[, db])

Read a pattern set written by write_patterns() or by SPMF (#SUP/#SID lines).

read_spmf(path[, name])

Read a sequence database in SPMF format.

read_xes(path[, case_key, activity_key, ...])

Read an XES event log (IEEE 1849) without external dependencies.

to_cytoscape(G[, scale])

Cytoscape.js / Cytoscape desktop JSON with node positions.

to_igraph(G)

Convert to a python-igraph graph (node name in the name attribute).

write_graph(G, path[, format, scale])

Write a graph with all node and edge attributes (format from the extension).

write_patterns(ps, path[, sids])

Write a pattern set; the format follows the extension.

write_spmf(db, path[, timestamps])

Write a database in SPMF format.

write_xes(db, path)

Write a database as an XES event log (one trace per sequence, one event per item).