Neo4j::Driver::Type::Path - Directed sequence of relationships between two nodes
version 0.40
$q = "MATCH p=(a:Person)-[k:KNOWS]->(b:Person) RETURN p"; $path = $driver->session->run($q)->list->[0]->get('p'); ($node_a, $node_b) = $path->nodes; ($relationship_k) = $path->relationships; ($a, $k, $b) = $path->elements;
A 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 be of length 0, 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::Driver::Type::Path inherits all methods from Neo4j::Types::Path.
@all = $path->elements;
See "elements" in Neo4j::Types::Path.
@nodes = $path->nodes;
See "nodes" in Neo4j::Types::Path.
@rels = $path->relationships;
See "relationships" in Neo4j::Types::Path.
Neo4j::Driver::Type::Path implements the following experimental features. These are subject to unannounced modification or removal in future versions. Expect your code to break if you depend upon these features.
$count = $path->elements; $count = $path->nodes; $count = $path->relationships;
The elements(), nodes(), and relationships() methods return the number of items if called in scalar context.
elements()
nodes()
relationships()
Until version 0.25, they died instead.
die
When paths are returned via HTTP JSON, the objects accessible via elements(), nodes(), and relationships() lack meta data for their labels and types. This is due to an issue in the Neo4j server.
Neo4j::Driver
Neo4j::Types::Path
Equivalent documentation for the official Neo4j drivers: Path (Java)
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.
This software is Copyright (c) 2016-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.
To install Neo4j::Driver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Neo4j::Driver
CPAN shell
perl -MCPAN -e shell install Neo4j::Driver
For more information on module installation, please visit the detailed CPAN module installation guide.