org.codehaus.plexus.util.dag

## Class DAG

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

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

      public class DAG
      extends java.lang.Object
      implements java.lang.Cloneable, java.io.Serializable

  DAG = Directed Acyclic Graph
  Version:
    $Id: DAG.java 8010 2009-01-07 12:59:50Z vsiveton $
  Author:
    Michal Maczka
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DAG()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addEdge(java.lang.String from, java.lang.String to)`
    `void` | `addEdge(Vertex from, Vertex to)`
    `Vertex` | `addVertex(java.lang.String label)` Adds vertex to DAG.
    `java.lang.Object` | `clone()`
    `java.util.List` | `getChildLabels(java.lang.String label)`
    `java.util.Set` | `getLabels()`
    `java.util.List` | `getParentLabels(java.lang.String label)`
    `java.util.List` | `getSuccessorLabels(java.lang.String label)` Return the list of labels of successor in order decided by topological sort
    `Vertex` | `getVertex(java.lang.String label)`
    `java.util.List` | `getVerticies()`
    `boolean` | `hasEdge(java.lang.String label1, java.lang.String label2)`
    `boolean` | `isConnected(java.lang.String label)` Indicates if there is at least one edge leading to or from vertex of given label
    `void` | `removeEdge(java.lang.String from, java.lang.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 Detail

    - #### DAG

          public DAG()

  - ### Method Detail

    - #### getVerticies

          public java.util.List getVerticies()

      Returns:

    - #### getLabels

          public java.util.Set getLabels()

    - #### addVertex

          public Vertex addVertex(java.lang.String label)

      Adds vertex to DAG. If vertex of given label alredy exist in DAG no vertex is added
      Parameters:
        `label` - The lable of the Vertex
      Returns:
        New vertex if vertext of given label was not presenst in the DAG or exising vertex if vertex of given labale was alredy added to DAG

    - #### addEdge

          public void addEdge(java.lang.String from,
                              java.lang.String to)
                       throws CycleDetectedException

      Throws:
        `CycleDetectedException`

    - #### addEdge

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

      Throws:
        `CycleDetectedException`

    - #### removeEdge

          public void removeEdge(java.lang.String from,
                                 java.lang.String to)

    - #### removeEdge

          public void removeEdge(Vertex from,
                                 Vertex to)

    - #### getVertex

          public Vertex getVertex(java.lang.String label)

    - #### hasEdge

          public boolean hasEdge(java.lang.String label1,
                                 java.lang.String label2)

    - #### getChildLabels

          public java.util.List getChildLabels(java.lang.String label)

      Parameters:
        `label` -
      Returns:

    - #### getParentLabels

          public java.util.List getParentLabels(java.lang.String label)

      Parameters:
        `label` -
      Returns:

    - #### clone

          public java.lang.Object clone()
                                 throws java.lang.CloneNotSupportedException

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

    - #### isConnected

          public boolean isConnected(java.lang.String label)

      Indicates if there is at least one edge leading to or from vertex of given label
      Returns:
        `true</true> if this vertex is connected with other vertex,`false` otherwise`

    - #### getSuccessorLabels

          public java.util.List getSuccessorLabels(java.lang.String label)

      Return the list of labels of successor in order decided by topological sort
      Parameters:
        `label` - The label of the vertex whose predessors are serched
      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.