public class Graph<V> extends java.lang.Object implements IGraphDataSource<V>, IBiDirectionalGraphDataSource<V>
Constructor and Description |
---|
Graph() |
Modifier and Type | Method and Description |
---|---|
void |
attachAsFirstObserver(IGraphObserver<V> observer)
Attaches a new graph observer to this graph data source as the first one.
|
void |
attachObserver(IGraphObserver<V> go)
Attaches a new graph observer to this graph data source.
|
void |
deleteEdge(V source,
V target)
Deprecated.
use explicitly
deleteEdgeThatExists(Object, Object) or
deleteEdgeIfExists(Object, Object) instead. To preserve backwards compatibility, this method
delegates to the latter. |
void |
deleteEdgeIfExists(V source,
V target)
No-op if trying to delete edge that does not exist
|
void |
deleteEdgeThatExists(V source,
V target) |
void |
deleteNode(V node)
Deletes the given node AND all of the edges going in and out from the node.
|
void |
detachObserver(IGraphObserver<V> go)
Detaches an already registered graph observer from this graph data source.
|
java.util.Set<V> |
getAllNodes()
Returns the complete set of nodes in the graph data source.
|
IMemoryView<V> |
getSourceNodes(V target)
Returns the source nodes for the given target node.
|
IMemoryView<V> |
getTargetNodes(V source)
Returns the target nodes for the given source node.
|
void |
insertEdge(V source,
V target) |
void |
insertNode(V node)
Insert the given node into the graph.
|
java.lang.String |
toString() |
public void deleteEdgeIfExists(V source, V target)
deleteEdgeIfExists(Object, Object)
public void deleteEdgeThatExists(V source, V target)
java.lang.IllegalStateException
- if trying to delete edge that does not existdeleteEdgeIfExists(Object, Object)
@Deprecated public void deleteEdge(V source, V target)
deleteEdgeThatExists(Object, Object)
or
deleteEdgeIfExists(Object, Object)
instead. To preserve backwards compatibility, this method
delegates to the latter.public void insertNode(V node)
public void deleteNode(V node)
public void attachObserver(IGraphObserver<V> go)
IGraphDataSource
attachObserver
in interface IGraphDataSource<V>
go
- the graph observerpublic void attachAsFirstObserver(IGraphObserver<V> observer)
IGraphDataSource
attachAsFirstObserver
in interface IGraphDataSource<V>
observer
- the graph observerpublic void detachObserver(IGraphObserver<V> go)
IGraphDataSource
detachObserver
in interface IGraphDataSource<V>
go
- the graph observerpublic java.util.Set<V> getAllNodes()
IGraphDataSource
getAllNodes
in interface IGraphDataSource<V>
public IMemoryView<V> getTargetNodes(V source)
IGraphDataSource
IMultiset
because of potential parallel edges in the graph data source.
The method must not return null.getTargetNodes
in interface IGraphDataSource<V>
source
- the source nodepublic IMemoryView<V> getSourceNodes(V target)
IBiDirectionalGraphDataSource
IMultiset
because of potential parallel edges in the graph data source.
The method must not return null.getSourceNodes
in interface IBiDirectionalGraphDataSource<V>
target
- the target nodepublic java.lang.String toString()
toString
in class java.lang.Object