com.datastax.driver.dse.graph

## Interface Path

• All Superinterfaces:
Iterable<GraphNode>

```public interface Path
extends Iterable<GraphNode>```
A walk through a graph as defined by a traversal.

Clients typically obtain instances of this class by calling `GraphNode.asPath()`, for example:

```     GraphNode n = dseSession.executeGraph("g.V().hasLabel('some_vertex').outE().inV().path()").one();
Path path = n.asPath();
```
• ### Method Summary

All Methods
Modifier and Type Method and Description
`List<Set<String>>` `getLabels()`
Returns the sets of labels of the steps traversed by this path, or an empty list, if this path is empty.
`GraphNode` `getObject(int index)`
Returns the object associated with the given step of this path.
`GraphNode` `getObject(String label)`
Returns the first object with the given label in this path.
`List<GraphNode>` `getObjects()`
Returns the objects traversed by this path, or an empty list, if this path is empty.
`List<GraphNode>` `getObjects(String label)`
Returns the objects with the given label in this path.
`boolean` `hasLabel(String label)`
Returns whether this path has at least one step with the given label.
`int` `size()`
Returns the size of this path, that is, the number of steps this path traversed.
• ### Methods inherited from interface java.lang.Iterable

`forEach, iterator, spliterator`
• ### Method Detail

• #### getLabels

`List<Set<String>> getLabels()`
Returns the sets of labels of the steps traversed by this path, or an empty list, if this path is empty.

The returned list is immutable.

Returns:
the sets of labels of the steps traversed by this path.
• #### getObjects

`List<GraphNode> getObjects()`
Returns the objects traversed by this path, or an empty list, if this path is empty.

The returned list is immutable.

Returns:
the objects traversed by this path.
• #### size

`int size()`
Returns the size of this path, that is, the number of steps this path traversed.
Returns:
the size of this path.
• #### getObject

`GraphNode getObject(int index)`
Returns the object associated with the given step of this path.

The step index is zero-based, i.e. the first step has index `0`.

If the index is out of bounds, this method returns `null`; no exception will be thrown.

Parameters:
`index` - the zero-based step index to find the object for.
Returns:
the object associated with the given step index.
• #### getObject

`GraphNode getObject(String label)`
Returns the first object with the given label in this path.

If the label is associated with more then one step, then this method returns the object at the first step with that label.

If the label does not exist in this path, this method returns `null`.

Parameters:
`label` - the label to find an object for.
Returns:
the first object with the given label.
• #### getObjects

`List<GraphNode> getObjects(String label)`
Returns the objects with the given label in this path.

If the label is unique, the returned list will contain only one element.

If the label is associated with more then one step, then the list will contain as many elements as the number of times the label appears in this path's steps, in order.

If the label does not exist in this path, an empty list is returned.

The returned list is immutable.

Parameters:
`label` - the label to find objects for.
Returns:
the objects with the given label.
• #### hasLabel

`boolean hasLabel(String label)`
Returns whether this path has at least one step with the given label.
Parameters:
`label` - the label to search.
Returns:
`true` if this path has at least one step with the given label, `false` otherwise.

Copyright © 2012–2018. All rights reserved.
{"ft_lang_label":"__label__en","ft_lang_prob":0.65245485,"math_prob":0.56637144,"size":2276,"snap":"2019-35-2019-39","text_gpt3_token_len":525,"char_repetition_ratio":0.1778169,"word_repetition_ratio":0.20555556,"special_character_ratio":0.23066784,"punctuation_ratio":0.13163972,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9673887,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-08-22T21:01:20Z\",\"WARC-Record-ID\":\"<urn:uuid:37d889f7-4c35-4693-beab-ed61d27d1f48>\",\"Content-Length\":\"19509\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b776f201-2d08-4c32-b422-40d5e15b5b19>\",\"WARC-Concurrent-To\":\"<urn:uuid:06065b10-907f-4773-ae7b-0ba7a9431363>\",\"WARC-IP-Address\":\"35.162.78.101\",\"WARC-Target-URI\":\"https://docs.datastax.com/en/drivers/java-dse/1.6/com/datastax/driver/dse/graph/Path.html\",\"WARC-Payload-Digest\":\"sha1:YYELHPR62UFAWP7SM7T6TQ73EQ57JTJQ\",\"WARC-Block-Digest\":\"sha1:ANLU6F5HFCT7TZHRAPWPEYV2KZOTVY3S\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-35/CC-MAIN-2019-35_segments_1566027317359.75_warc_CC-MAIN-20190822194105-20190822220105-00091.warc.gz\"}"}