public class Walk extends Object implements Iterable<Set<Edge>>
Walk
describes a graph traversal which begins at a vertex and
comprises of: Edge
objects, where the source of
one edge must follow on from the destination of the previousEntity
objects which are associated to each of
the vertices visited on the Walk. Vertices with no associated entities are
still represented, but only as empty collections.For example, a Walk through a simple graph could look like:
A --> B --> C
\ \
\ (Entity2, Entity3)
\
(Entity1)
Edges: A -> B, B -> C
Entities: [], [Entity1], [Entity2, Entity3]
Modifier and Type | Class and Description |
---|---|
static class |
Walk.Builder |
Constructor and Description |
---|
Walk(List<Set<Edge>> edges,
List<Map.Entry<Object,Set<Entity>>> entities)
Constructor used by Jackson.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Object |
getDestinationVertex() |
List<Set<Edge>> |
getEdges() |
List<Set<Entity>> |
getEntities() |
List<Map.Entry<Object,Set<Entity>>> |
getEntitiesAsEntries() |
Set<Entity> |
getEntitiesAtDistance(int n)
Get all of the entities at some distance from the start of the walk.
|
Set<Entity> |
getEntitiesForVertex(Object vertex)
Retrieve all of the entities associated with a particular vertex on the
walk.
|
Object |
getSourceVertex() |
Set<Object> |
getVertexSet()
Get the
Set of vertices on the walk. |
List<Object> |
getVerticesOrdered()
Get an ordered
List of the vertices on the walk. |
int |
hashCode() |
boolean |
isPath()
A walk is also a path if it contains no repeated vertices (i.e.
|
boolean |
isTrail()
A walk is also a trail if it contains no repeated edges.
|
Iterator<Set<Edge>> |
iterator() |
int |
length() |
String |
toString() |
forEach, spliterator
public Set<Entity> getEntitiesForVertex(Object vertex)
vertex
- the vertex of interestSet
of all of the entities associated with the vertexpublic Set<Entity> getEntitiesAtDistance(int n)
n
- the distance from the start of the walk (in terms of the number
of edges that would have to be traversed)public List<Object> getVerticesOrdered()
List
of the vertices on the walk.
This will include any repeated vertices.
public Set<Object> getVertexSet()
Set
of vertices on the walk.public int length()
public boolean isTrail()
true
if the walk does not contain any repeated edges,
otherwise false
public boolean isPath()
true
if the walk does not contain any repeated vertices,
otherwise false
public Object getSourceVertex()
public Object getDestinationVertex()
Copyright © 2022. All rights reserved.