Package org.codehaus.plexus.util.dag

# Class DAG

java.lang.Object
org.codehaus.plexus.util.dag.DAG

All Implemented Interfaces:
  `Serializable`, `Cloneable`

public class DAG extends Object implements Cloneable, Serializable
DAG = Directed Acyclic Graph

Author:
  Michal Maczka TODO this class should be renamed from DAG to Dag
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`DAG()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addEdge(String from, String to)`
`void`
`addEdge(Vertex from, Vertex to)`
`Vertex`
`addVertex(String label)`
Adds vertex to DAG.
`Object`
`clone()`
`List<String>`
`getChildLabels(String label)`
`Set<String>`
`getLabels()`
`List<String>`
`getParentLabels(String label)`
`List<String>`
`getSuccessorLabels(String label)`
Return the list of labels of successor in order decided by topological sort
`Vertex`
`getVertex(String label)`
`List<Vertex>`
`getVertices()`
`List<Vertex>`
`getVerticies()`
Deprecated.
instead use `getVertices()`
`boolean`
`hasEdge(String label1, String label2)`
`boolean`
`isConnected(String label)`
Indicates if there is at least one edge leading to or from vertex of given label
`void`
`removeEdge(String from, String to)`
`void`
`removeEdge(Vertex from, Vertex to)`

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DAG

public DAG()

## Method Details

### getVertices

public List<Vertex> getVertices()

Returns:
  the vertices

### getVerticies

@Deprecated public List<Vertex> getVerticies()
Deprecated.
instead use `getVertices()`

Returns:
  the vertices

### getLabels

public Set<String> getLabels()

### addVertex

public Vertex addVertex(String label)
Adds vertex to DAG. If vertex of given label already exist in DAG no vertex is added

Parameters:
  `label` - The label of the Vertex
Returns:
  New vertex if vertex of given label was not present in the DAG or existing vertex if vertex of given label was already added to DAG

### addEdge

public void addEdge(String from, String to) throws CycleDetectedException

Throws:
  `CycleDetectedException`

### addEdge

public void addEdge(Vertex from, Vertex to) throws CycleDetectedException

Throws:
  `CycleDetectedException`

### removeEdge

public void removeEdge(String from, String to)

### removeEdge

public void removeEdge(Vertex from, Vertex to)

### getVertex

public Vertex getVertex(String label)

### hasEdge

public boolean hasEdge(String label1, String label2)

### getChildLabels

public List<String> getChildLabels(String label)

Parameters:
  `label` - see name
Returns:
  the childs

### getParentLabels

public List<String> getParentLabels(String label)

Parameters:
  `label` - see name
Returns:
  the parents

### clone

public Object clone() throws CloneNotSupportedException

Overrides:
  `clone` in class `Object`
Throws:
  `CloneNotSupportedException`
See Also:
  - `Object.clone()`

### isConnected

public boolean isConnected(String label)
Indicates if there is at least one edge leading to or from vertex of given label

Parameters:
  `label` - the label
Returns:
  `true` if this vertex is connected with other vertex,`false` otherwise

### getSuccessorLabels

public List<String> getSuccessorLabels(String label)
Return the list of labels of successor in order decided by topological sort

Parameters:
  `label` - The label of the vertex whose predecessors are searched
Returns:
  The list of labels. Returned list contains also the label passed as parameter to this method. This label should always be the last item in the list.