++ed by:
MAJENSEN
Author image Arne Johannessen

NAME

Neo4j::Types::Path - Represents a directed sequence of relationships between two nodes

VERSION

version 1.00

SYNOPSIS

 ($node1, $rel, $node2) = $path->elements;
 
 ($node1, $node2) = $path->nodes;
 ($rel)           = $path->relationships;

DESCRIPTION

A Neo4j path is a directed sequence of relationships between two nodes. Its direction may be separate from that of the relationships traversed.

It is allowed to have zero length, meaning there are no relationships in it. In this case, it contains only a single node which is both the start and the end of the path.

Neo4j::Types::Path objects may be created by executing a Cypher statement against a Neo4j database server.

This module makes no assumptions about its internal data structure. While default implementations for all methods are provided, inheritors are free to override these according to their needs. The default implementations assume the data is stored in the format defined for Neo4j::Bolt::Path.

METHODS

Neo4j::Types::Path implements the following methods.

elements

 @all = $path->elements;

Return the path as a list alternating between nodes and relationships in path sequence order.

nodes

 @nodes = $path->nodes;

Return all nodes of this path.

The start node of this path is the first node in the list this method returns, the end node is the last one.

 @nodes = $path->nodes;
 $start_node = $nodes[0];
 $end_node   = $nodes[@nodes - 1];

relationships

 @rels = $path->relationships;

Return all relationships of this path.

The length of a path is defined as the number of relationships.

 @rels = $path->relationships;
 $length = scalar @rels;

BUGS

The behaviour of the elements(), nodes() and relationships() methods when called in scalar context has not yet been defined.

SEE ALSO

AUTHOR

Arne Johannessen <ajnn@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2021 by Arne Johannessen.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)