telepath / com.github.giedomak.telepath.datamodels.graph / Path

Path

data class Path : Serializable, Comparable<Path> (source)

The Path model contains a list of edges, as well as a list of nodes to represent a specific path.

A path is basically an ordered set of nodes and edges we encounter along a path through the graph. Let's say we've got this path: Tim - likes - Stef - loves - Bregt. Tim, Stef and Bregt are nodes, likes and loves are edge labels.

Our Path data model has two properties to maintain the nodes we encounter, and the edges we encounter. The list of edges is hidden inside the PathIdentifierStore, where we can retrieve the list of edges by using our pathId.

In our example, our path instance holds a pathId which points to a list with ['likes', 'loves']. Our path instance holds a list of nodes with ['Tim', 'Stef', 'Bregt'] for simplicity.

See https://github.com/maxsumrall/PathDB/blob/master/src/main/java/com/pathdb/pathIndex/Path.java for the Path data class used in PathDB.

Constructors

<init>

Path(pathId: Long, nodes: List<Node>)

Creates a Path with an ID and a list of nodes. The list of nodes should have at least two nodes.

Properties

nodes

val nodes: List<Node>

The ordered list of nodes along this Path.

pathId

val pathId: Long

The ID given to a specific Path. We can use the PathIdentifierStore to get the list of edges.

Functions

compareTo

fun compareTo(other: Path): Int

inverse

fun inverse(): Path