public class DirectedAcyclicGraph<V,E> extends Object implements IGraph<V,E>
DirectedAcyclicGraph.CycleException if any new edge creates a cycle.| Modifier and Type | Class and Description |
|---|---|
static class |
DirectedAcyclicGraph.CycleException |
| Constructor and Description |
|---|
DirectedAcyclicGraph() |
DirectedAcyclicGraph(ToLongFunction<V> hashFn,
BiPredicate<V,V> equalsFn) |
finalize, getClass, notify, notifyAll, wait, wait, waitindexOf, iterator, merge, nth, replace, replace, size, splitnth, saveforEach, spliteratorpublic DirectedAcyclicGraph()
public DirectedAcyclicGraph(ToLongFunction<V> hashFn, BiPredicate<V,V> equalsFn)
public static <V,E> DirectedAcyclicGraph<V,E> from(DirectedGraph<V,E> graph)
graphDirectedAcyclicGraph.CycleException - if graph contains a cyclepublic DirectedGraph<V,E> directedGraph()
public DirectedAcyclicGraph<V,E> link(V from, V to)
public Set<V> in(V vertex)
IGraphIGraph.out(Object).public Set<V> out(V vertex)
IGraphIGraph.in(Object).public DirectedAcyclicGraph<V,E> link(V from, V to, E edge, BinaryOperator<E> merge)
link in interface IGraph<V,E>from - the source of the edgeto - the destination of the edgeedge - the value of the edgemerge - the merge function for the edge values, if an edge already existsDirectedAcyclicGraph.CycleException - if the new edge creates a cyclepublic DirectedAcyclicGraph<V,E> unlink(V from, V to)
public DirectedAcyclicGraph<V,E> merge(IGraph<V,E> graph, BinaryOperator<E> merge)
public DirectedAcyclicGraph<V,E> select(ISet<V> vertices)
public DirectedAcyclicGraph<V,E> add(V vertex)
public DirectedAcyclicGraph<V,E> remove(V vertex)
public DirectedAcyclicGraph<V,E> forked()
ICollectionIf only a single function or scope uses the data structure, it can be left as a linear data structure, which can have significant performance benefits.
If the data structure is already forked, it will simply return itself.
public DirectedAcyclicGraph<V,E> linear()
ICollection
If ICollection.forked() is called on a linear collection, all references to that linear collection should be discarded.
If the data structure is already linear, it will simply return itself.
public boolean isLinear()
public boolean isDirected()
isDirected in interface IGraph<V,E>public DirectedAcyclicGraph<V,E> transpose()
public ToLongFunction<V> vertexHash()
vertexHash in interface IGraph<V,E>public BiPredicate<V,V> vertexEquality()
vertexEquality in interface IGraph<V,E>