NAME

Neo4j::Types::Path - Represents a Neo4j path of nodes and relationships

VERSION

version 2.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.

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.

In scalar context, return the number of elements in this path.

$count = scalar $path->elements;

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];

In scalar context, return the number of nodes in this path.

$count = scalar $path->nodes;

relationships

@rels = $path->relationships;

Return all relationships of this path.

In scalar context, return the number of relationships in this path. The length of a path is defined as the number of relationships.

$length = scalar $path->relationships;

SEE ALSO

AUTHOR

Arne Johannessen <ajnn@cpan.org>

If you contact me by email, please make sure you include the word "Perl" in your subject header to help beat the spam filters.

COPYRIGHT AND LICENSE

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

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0 or (at your option) the same terms as the Perl 5 programming language system itself.