public class Graph extends Object
Modifier and Type | Class and Description |
---|---|
class |
Graph.Edge |
Constructor and Description |
---|
Graph() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(Integer source,
Integer target,
String edgeName)
Add an edge to the graphs
|
Integer |
addVertex(String name)
Add a new vertex to the Graph
|
boolean |
containsEdge(Integer source,
Integer target)
Returns whether graph contains an edge from source to target vertex
|
Set<Graph.Edge> |
getIncomingEdges(Integer vertexIndex)
Returns set of incoming edges to vertex
|
Set<Graph.Edge> |
getOutgoingEdges(Integer vertexIndex)
Returns set of outgoing edges from vertex
|
Set<Integer> |
getSourceNodes()
Gets set of vertex indexes which do not have any incoming edges
|
int |
getVerticeCount()
Returns count of vertices in the graph
|
boolean |
isJoin(Integer vertexIndex)
Returns whether an vertex has more than one incoming edge
|
boolean |
isSplit(Integer vertexIndex)
Returns whether an vertex has more than one outgoing edge
|
public Integer addVertex(String name) throws ProcessValidationException
name
- name of the vertexProcessValidationException
public void addEdge(Integer source, Integer target, String edgeName)
source
- source vertextarget
- targe vertexedgeName
- name of the edgepublic boolean containsEdge(Integer source, Integer target)
source
- vertex indextarget
- vertex indexpublic int getVerticeCount()
public Set<Graph.Edge> getIncomingEdges(Integer vertexIndex)
vertexIndex
- index of vertexpublic Set<Graph.Edge> getOutgoingEdges(Integer vertexIndex)
vertexIndex
- index of vertexpublic Set<Integer> getSourceNodes()
public boolean isSplit(Integer vertexIndex)
vertexIndex
- index of vertexpublic boolean isJoin(Integer vertexIndex)
vertexIndex
- index of vertexCopyright © 2020 Pivotal Software, Inc.. All rights reserved.