spmviz.networks.prefix_tree#

spmviz.networks.prefix_tree(db, max_depth=None, min_count=1, anchor=None, direction='forward', with_end=True)[source]#

Trie of the sequences (the aggregation behind sunbursts, icicles, LifeFlow and word trees).

Parameters:
dbSequenceDatabase
max_depthint, optional
min_countint

Prune nodes passed by fewer sequences.

anchorpattern, optional

Start every sequence at the end (direction="forward") or the start ("backward") of the first occurrence of this pattern; sequences without it are skipped. This gives the two halves of a word tree.

direction{“forward”, “backward”}
with_endbool

Count the sequences that end at each node (n_end).

Returns:
networkx.DiGraph

Rooted at "∅"; node attributes item (token), depth, count, n_end, path (text), mean_time (elapsed time from the anchor or the start, element index units without timestamps) and entropy of the continuation at the node (bits, end included).