Package ai.libs.jaicore.graph
Class Graph<T>
- java.lang.Object
-
- ai.libs.jaicore.graph.Graph<T>
-
- Direct Known Subclasses:
LabeledGraph
public class Graph<T> extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(T from, T to)voidaddGraph(Graph<T> g)voidaddItem(T item)voidaddPath(java.util.List<T> path)booleanequals(java.lang.Object obj)java.util.Set<T>getConnected(T item)java.util.Set<T>getItems()java.lang.StringgetLineBasedStringRepresentation()Creates a new line for each path in the graph where the prefix common to the previous line is omitted.java.lang.StringgetLineBasedStringRepresentation(int offset)java.util.Set<T>getPredecessors(T item)TgetRoot()java.util.Collection<T>getSinks()java.util.Collection<T>getSources()java.util.Set<T>getSuccessors(T item)booleanhasEdge(T from, T to)inthashCode()booleanhasItem(T item)booleanhasPath(java.util.List<T> nodes)booleanisEmpty()booleanisGraphSane()booleanisUseBackPointers()booleanisUseForwardPointers()voidremoveEdge(T from, T to)voidremoveItem(T item)voidsetUseBackPointers(boolean useBackPointers)voidsetUseForwardPointers(boolean useForwardPointers)
-
-
-
Method Detail
-
addItem
public void addItem(T item)
-
addPath
public void addPath(java.util.List<T> path)
-
getItems
public java.util.Set<T> getItems()
-
hasItem
public boolean hasItem(T item)
-
hasPath
public boolean hasPath(java.util.List<T> nodes)
-
removeItem
public void removeItem(T item)
-
getSources
public final java.util.Collection<T> getSources()
-
getRoot
public final T getRoot()
-
getSinks
public final java.util.Collection<T> getSinks()
-
isEmpty
public boolean isEmpty()
-
getLineBasedStringRepresentation
public java.lang.String getLineBasedStringRepresentation()
Creates a new line for each path in the graph where the prefix common to the previous line is omitted. The order is obtained by BFS.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getLineBasedStringRepresentation
public java.lang.String getLineBasedStringRepresentation(int offset)
-
isGraphSane
public boolean isGraphSane()
-
isUseBackPointers
public boolean isUseBackPointers()
-
setUseBackPointers
public void setUseBackPointers(boolean useBackPointers)
-
isUseForwardPointers
public boolean isUseForwardPointers()
-
setUseForwardPointers
public void setUseForwardPointers(boolean useForwardPointers)
-
-