T - type of the nodes' labelspublic class Digraph<T> extends Object implements Iterable<DigraphNode<T>>
| Modifier and Type | Method and Description |
|---|---|
DigraphNode<T> |
addNode(T val) |
Collection<DigraphNode<T>> |
getLeafs()
leaves are nodes with an outdegree of 0
|
Collection<DigraphNode<T>> |
getRoots()
roots are nodes with an indegree of 0
|
Collection<T> |
getValues() |
Iterator<DigraphNode<T>> |
iterator() |
int |
numberOfEdges() |
int |
numberOfNodes() |
void |
printTree(OutputStream os,
DigraphNode<T> root)
prints a tree
|
void |
printTrees(OutputStream os)
prints a tree for every root node in the graph
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic DigraphNode<T> addNode(T val)
public int numberOfNodes()
public int numberOfEdges()
public Collection<DigraphNode<T>> getLeafs()
public Collection<DigraphNode<T>> getRoots()
public Collection<T> getValues()
public void printTrees(OutputStream os)
os - public void printTree(OutputStream os, DigraphNode<T> root)
os - root - the root of the treepublic Iterator<DigraphNode<T>> iterator()
iterator in interface Iterable<DigraphNode<T>>Copyright © 2018. All rights reserved.