# Nodes(path) returns the node graph, NOT a list

I'm trying to represent Enigma rotors with neo4j.

``````match (input:Input{IN:"A"}) match path=(n:Rotor1{IN:input.IN})-[*]-(m) return input,nodes(path)
``````

returns the connected nodes, but never a list. Is it because the path is not oriented?
How can I extract the "last" node (F),i.e. the coding of (A) with these settings.

You can adjust how you want to review the results on the left side of the result pane. Currently you're viewing the graph result view. You can view the Table result view below and you should see, per row, your `input` node followed by a list of the nodes in the path for that row.

As far as the "last" node, that depends upon what defines a last node.

Is it that there should be no other relationships aside from the one you traversed to get to the node? In that case you should add `WHERE size((m)--()) = 1`.

Is it the node at furthest distance from `n`? In that case order the paths by length descending and limit:

``````WITH input, path
ORDER BY length(path) DESC
LIMIT 1
RETURN input, nodes(path)
``````

If there's some other criteria then you'll have to figure out how to include that in your query.

thank you Andrew, my final code for the furthest distance:

``````match (input:Input{IN:"A"}) match path=(n:Rotor1{IN:input.IN})-[*]-(m) WITH input, path
ORDER BY length(path) DESC
LIMIT 1
with input, nodes(path)[length(path)] as result
match(output:Output) where output.IN=result.IN
RETURN input,output
``````

gives the result:

BTW, it's the Enigma coding for "A" with rotors III,II,I, rings A,A,A, no plugboard