API

Import the package as:

import elpigraph

Principal graphs

computeElasticPrincipalCurve(X, NumNodes[, …]) Construct a principal elastic curve
computeElasticPrincipalCircle(X, NumNodes[, …]) Construct a principal elastic circle
computeElasticPrincipalTree(X, NumNodes[, …]) Construct a principal elastic tree
generateInitialConfiguration(X, Nodes[, …]) Produce an initial graph with a given structure

Graph editing

addPath(X, PG, source, target[, n_nodes, …]) Add path (principal curve) between two nodes in the principal graph
delPath(X, PG, source, target[, …]) Delete path between two nodes in the principal graph
findPaths(X, PG[, min_path_len, nnodes, …]) This function tries to add extra paths to the graph by computing a series of principal curves connecting two nodes and retaining plausible ones using heuristic parameters
ExtendLeaves(X, PG[, Mode, ControlPar, …]) Extend leaves with additional nodes
CollapseBranches(X, PG[, Mode, ControlPar, …]) Filter “small” branches
ShiftBranching(X, PG[, SelectionMode, …]) Move branching nodes to areas with higher point density
fineTuneBR(X, NumNodes[, NumEdges, …]) Expand the nodes around a branching point.

Utils

utils.getProjection(X, PG) Compute graph projection from principal graph dict (result stored in PG dict under ‘projection’ key)
utils.getPseudotime(X, PG, source[, target, …]) Compute pseudotime given source: int source node target: int optional target node nodes_to_include: list optional nodes to include in the path (useful for complex topologies with loops, where multiple paths are possible between 2 nodes) project: bool if False, will save computation time by using the projection already stored in PG dict (computed using elpigraph.utils.getProjection)
utils.getWeights(X[, bandwidth, griddelta, …]) Get point weights as the inverse density of data X: np.array, (n_sample x n_dims) bandwidth: sklearn KernelDensity bandwidth if method == ‘sklearn’ griddelta: FFTKDE grid step size if method ==’fft’ exponent: density values are raised to the power of exponent

Plotting

plot.PlotPG(X, PG[, X_color, Node_color, …])