public class Graph<V> extends java.lang.Object implements IGraphDataSource<V>, IBiDirectionalGraphDataSource<V>
| Constructor and Description |
|---|
Graph() |
| Modifier and Type | Method and Description |
|---|---|
void |
attachObserver(IGraphObserver<V> go)
Attach a new graph observer.
|
void |
deleteEdge(V source,
V target) |
void |
deleteNode(V node) |
java.lang.Integer[] |
deleteRandomEdge() |
void |
detachObserver(IGraphObserver<V> go)
Detach an existing observer.
|
java.util.Set<V> |
getAllNodes()
Get all nodes of the graph.
|
java.util.List<V> |
getSourceNodes(V target)
Returns the source nodes of those edges that end in target.
|
java.util.List<V> |
getTargetNodes(V source)
Get those nodes that are the target of an edge starting with source.
|
void |
insertEdge(V source,
V target) |
void |
insertNode(V node) |
java.lang.Integer[] |
insertRandomEdge() |
java.lang.String |
toString() |
public void insertNode(V node)
public void deleteNode(V node)
public void attachObserver(IGraphObserver<V> go)
IGraphDataSourceattachObserver in interface IGraphDataSource<V>go - the graph observerpublic void detachObserver(IGraphObserver<V> go)
IGraphDataSourcedetachObserver in interface IGraphDataSource<V>go - the graph observerpublic java.util.Set<V> getAllNodes()
IGraphDataSourcegetAllNodes in interface IGraphDataSource<V>public java.util.List<V> getTargetNodes(V source)
IGraphDataSourcegetTargetNodes in interface IGraphDataSource<V>source - the source nodepublic java.util.List<V> getSourceNodes(V target)
IBiDirectionalGraphDataSourceList as
multiple edges can be present between two arbitrary nodes. If no such node can be found than the method should
return null.getSourceNodes in interface IBiDirectionalGraphDataSource<V>target - the target nodepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Integer[] deleteRandomEdge()
public java.lang.Integer[] insertRandomEdge()