Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## baseCode.dataStructure.graph
Class DirectedGraphNode

    java.lang.Object
      baseCode.common.Visitable
          baseCode.dataStructure.graph.AbstractGraphNode
              baseCode.dataStructure.graph.DirectedGraphNode

All Implemented Interfaces:
  java.lang.Comparable, GraphNode

public class DirectedGraphNode
extends AbstractGraphNode
implements java.lang.Comparable

A graph node that has the concept of parents and children. Keys can be anything, but probably Strings or Integers.

Copyright (c) Columbia University

Version:
  $Id: DirectedGraphNode.java,v 1.10 2004/07/27 03:18:58 pavlidis Exp $
Author:
  Paul Pavlidis

Field Summary
`protected java.util.Set` | `children`
`protected java.util.Set` | `parents`
`protected int` | `topoSortOrder`

Fields inherited from class baseCode.dataStructure.graph.AbstractGraphNode
`graph, item, key, log, visited`

Constructor Summary
`DirectedGraphNode(java.lang.Object key, java.lang.Object value, Graph graph)`

Method Summary
`void` | `addChild(java.lang.Object newChildKey)`
`void` | `addParent(java.lang.Object newParentKey)`
`java.lang.Object` | `clone()` Makes a copy of this node.
`int` | `compareTo(java.lang.Object o)` Uses the topological sort order.
`java.util.Set` | `getAllChildNodes()` Get all the children of this node, recursively.
`java.util.Set` | `getAllParentNodes()` Get all the parents of this node, recursively.
`Graph` | `getChildGraph()` Get the subgraph starting from this node, including this node.
`java.lang.Object` | `getChildKeys()`
`java.util.Set` | `getChildNodes()` Get the immediate children of this node.
`java.lang.Object` | `getParentKeys()`
`java.util.Set` | `getParentNodes()` Get the immediate parents of this node.
`int` | `getTopoSortOrder()`
`boolean` | `hasChild(java.lang.Object j)` Check to see if this node has a particular immediate child.
`boolean` | `hasParent(java.lang.Object j)` Check to see if this node has a particular immediate parent.
`int` | `inDegree()`
`boolean` | `isLeaf()`
`int` | `numChildren()`
`int` | `numParents()`
`int` | `outDegree()`
`void` | `prune()` Remove connections that are to nodes not contained in this graph
`void` | `setTopoSortOrder(int i)`
`java.lang.String` | `toString()`

Methods inherited from class baseCode.dataStructure.graph.AbstractGraphNode
`getGraph, getItem, getKey, isVisited, mark, setGraph, setItem, setValue, unMark`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### parents

    protected java.util.Set parents

### children

    protected java.util.Set children

### topoSortOrder

    protected int topoSortOrder

Constructor Detail

### DirectedGraphNode

    public DirectedGraphNode(java.lang.Object key,
                             java.lang.Object value,
                             Graph graph)

Parameters:
  `key` - Object
  `value` - Object
  `graph` - Graph

Method Detail

### setTopoSortOrder

    public void setTopoSortOrder(int i)

  Parameters:
    `i` - int

### getTopoSortOrder

    public int getTopoSortOrder()

  Returns:
    int

### addChild

    public void addChild(java.lang.Object newChildKey)

  Parameters:
    `newChildKey` - Object

### addParent

    public void addParent(java.lang.Object newParentKey)

  Parameters:
    `newParentKey` - Object

### getParentKeys

    public java.lang.Object getParentKeys()

  Returns:
    Object

### getChildKeys

    public java.lang.Object getChildKeys()

  Returns:
    Object

### getChildNodes

    public java.util.Set getChildNodes()

  Get the immediate children of this node. References to the DirectedGraphNodes are given, as opposed to key values.

  Returns:
    Set containing the child nodes of this node.

### getParentNodes

    public java.util.Set getParentNodes()

  Get the immediate parents of this node. References to the DirectedGraphNodes are given, as opposed to key values.

  Returns:
    Set

### getChildGraph

    public Graph getChildGraph()

  Get the subgraph starting from this node, including this node.

  Returns:
    Graph

### isLeaf

    public boolean isLeaf()

  Returns:

### outDegree

    public int outDegree()

  Returns:
    int number of immediate children this node has.

### inDegree

    public int inDegree()

  Returns:
    int number of immediate parents this node has.

### numChildren

    public int numChildren()

  Returns:
    int how many children this node has, determined recursively.

### numParents

    public int numParents()

  Returns:
    int how many parents this node has, determined recursively.

### getAllChildNodes

    public java.util.Set getAllChildNodes()

  Get all the children of this node, recursively.

### getAllParentNodes

    public java.util.Set getAllParentNodes()

  Get all the parents of this node, recursively.

  Returns:

### hasChild

    public boolean hasChild(java.lang.Object j)

  Check to see if this node has a particular immediate child.

  Parameters:
    `j` - Object
  Returns:
    boolean

### hasParent

    public boolean hasParent(java.lang.Object j)

  Check to see if this node has a particular immediate parent.

  Parameters:
    `j` - Object
  Returns:
    boolean

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `AbstractGraphNode`

### prune

    public void prune()

  Remove connections that are to nodes not contained in this graph

### compareTo

    public int compareTo(java.lang.Object o)

  Uses the topological sort order.

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  Parameters:
    `o` - Object
  Returns:
    int

### clone

    public java.lang.Object clone()

  Makes a copy of this node. It does not make a deep copy of the contents. This should be used when making subgraphs.

  Returns:
    Object

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2005 Columbia University. All Rights Reserved.