Graph-plotting module
- class xettel.graph.ZKGraph
Class for handling graph-related operation on a Zettelkasten
The __init__ method only initialises self.nxgraph.
- nxgraph
networkx graph built from a Zettelkasten
- pgvgraph
pygraphviz graph built from self.nxgraph
- zk
Zettelkasten from which the nxgraph is built.
- draw_graph(path: str) None
- Draws the graph using graphviz to the specified path
with desired extension
- Parameters
path (str) – the path to write to.
- classmethod from_zettelkasten(zk: ZettelkastenAbstract) ZKGraph
Builds a networkx graph from an initialised zettelkasten
- Parameters
zk (ZettelkastenAbstract) – a Zettelkasten
- Returns
An instance of this class with self.nxgraph properly initialised.
- initialise_nx_graph_from_zk() None
Initialises a networkx graph from a Zettelkasten. Assumes that the Zettelkasten has been properly initialised.
- is_connected() bool
Tests is graph fron Zettelkasten is weakly connected. Assumes that the nx graph has already been initialised.
- Returns
A boolean, True if the nxgraph is weakly connected.
- set_graphviz_layout(program: str = 'neato', model: str = 'circuit') None
Runs the graphviz’s program to lay out the nodes accordingly
- xettel.graph.name(uid: int, zk: ZettelkastenAbstract) str
Extract raw name of the zettel
- Parameters
uid (int) – uid of the Zettel.
zk (ZettelkastenAbstract) – Zettelkasten
- Returns
Basename of the Zettel
- xettel.graph.url(uid: int, zk: ZettelkastenAbstract) str
Gives the url the graph’s nodes should point to
- Parameters
uid (int) – uid of the Zettel
zk (ZettelkastenAbstract) – Zettelkasten
- Returns
Path to the export url of the Zettel (only html implemented so far).