public abstract class AbstractGraph extends AbstractElement implements Graph, Replayable
This class provides a basic implementation of
Graph interface, to minimize the effort
required to implement this interface. It provides event management
implementing all the methods of Pipe. It also
manages strict checking and auto-creation policies, as well as other services
as displaying, reading and writing.
Subclasses have to maintain data structures allowing to efficiently access
graph elements by their id or index and iterating on them. They also have to
maintain coherent indices of the graph elements. When AbstractGraph decides
to add or remove elements, it calls one of the "callbacks"
addNodeCallback(AbstractNode),
addEdgeCallback(AbstractEdge),
removeNodeCallback(AbstractNode),
removeEdgeCallback(AbstractEdge), clearCallback(). The role
of these callbacks is to update the data structures and to re-index elements
if necessary.
AbstractElement.AttributeChangeEventReplayable.Controller| Constructor and Description |
|---|
AbstractGraph(String id)
The same as
AbstractGraph(id, true, false) |
AbstractGraph(String id,
boolean strictChecking,
boolean autoCreate)
Creates a new graph.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttributeSink(AttributeSink sink)
Add a sink for attribute events only.
|
<T extends Edge> |
addEdge(String id,
int index1,
int index2)
Like
Graph.addEdge(String, String, String) but the nodes are
identified by their indices. |
<T extends Edge> |
addEdge(String id,
int fromIndex,
int toIndex,
boolean directed)
Like
Graph.addEdge(String, String, String, boolean) but the nodes are
identified by their indices. |
<T extends Edge> |
addEdge(String id,
Node node1,
Node node2)
Like
Graph.addEdge(String, String, String) but the node references are
given instead of node identifiers. |
<T extends Edge> |
addEdge(String id,
Node from,
Node to,
boolean directed)
Like
Graph.addEdge(String, String, String, boolean) but the node
references are given instead of node identifiers. |
<T extends Edge> |
addEdge(String id,
String node1,
String node2)
Adds an undirected edge between nodes.
|
<T extends Edge> |
addEdge(String id,
String from,
String to,
boolean directed)
Like
Graph.addEdge(String, String, String), but this edge can be
directed between the two given nodes. |
void |
addElementSink(ElementSink sink)
Add a sink for elements events only.
|
<T extends Node> |
addNode(String id)
Add a node in the graph.
|
void |
addSink(Sink sink)
Add a sink for all graph events (attributes and graph elements) coming
from this source.
|
Iterable<AttributeSink> |
attributeSinks()
Returns an "iterable" of
AttributeSink objects registered to this
graph. |
void |
clear()
Empty the graph completely by removing any references to nodes or edges.
|
void |
clearAttributeSinks()
Remove all listener attribute sinks.
|
void |
clearElementSinks()
Remove all listener element sinks.
|
void |
clearSinks()
Remove all listener sinks.
|
Viewer |
display()
Utility method that creates a new graph viewer, and register the graph in
it.
|
Viewer |
display(boolean autoLayout)
Utility method that creates a new graph viewer, and register the graph in
it.
|
void |
edgeAdded(String sourceId,
long timeId,
String edgeId,
String fromNodeId,
String toNodeId,
boolean directed)
An edge was inserted in graph.
|
void |
edgeAttributeAdded(String sourceId,
long timeId,
String edgeId,
String attribute,
Object value)
A edge attribute was added.
|
void |
edgeAttributeChanged(String sourceId,
long timeId,
String edgeId,
String attribute,
Object oldValue,
Object newValue)
A edge attribute was changed.
|
void |
edgeAttributeRemoved(String sourceId,
long timeId,
String edgeId,
String attribute)
A edge attribute was removed.
|
EdgeFactory<? extends Edge> |
edgeFactory()
The factory used to create edge instances.
|
void |
edgeRemoved(String sourceId,
long timeId,
String edgeId)
An edge of graph was removed.The nodes the edge connects may already have
been removed from the graph.
|
Iterable<ElementSink> |
elementSinks()
Returns an "iterable" of
ElementSink objects registered to this
graph. |
<T extends Edge> |
getEachEdge()
This implementation uses
getEdgeIterator() |
<T extends Node> |
getEachNode()
This implementation uses
getNodeIterator() |
abstract <T extends Edge> |
getEdge(int index)
Get an edge by its index.
|
abstract <T extends Edge> |
getEdge(String id)
Get an edge by its identifier.
|
abstract int |
getEdgeCount()
Number of edges in this graph.
|
abstract <T extends Edge> |
getEdgeIterator()
Iterator on the set of edges, in an undefined order.
|
<T extends Edge> |
getEdgeSet()
This implementation uses
getEdgeIterator() and
getEdgeCount() |
abstract <T extends Node> |
getNode(int index)
Get a node by its index.
|
abstract <T extends Node> |
getNode(String id)
Get a node by its identifier.
|
abstract int |
getNodeCount()
Number of nodes in this graph.
|
abstract <T extends Node> |
getNodeIterator()
Iterator on the set of nodes, in an undefined order.
|
<T extends Node> |
getNodeSet()
This implementation uses
getNodeIterator() and
getNodeCount() |
Replayable.Controller |
getReplayController()
Get a controller to replay the graph.
|
double |
getStep()
The current step.
|
void |
graphAttributeAdded(String sourceId,
long timeId,
String attribute,
Object value)
A graph attribute was added.
|
void |
graphAttributeChanged(String sourceId,
long timeId,
String attribute,
Object oldValue,
Object newValue)
A graph attribute was changed.
|
void |
graphAttributeRemoved(String sourceId,
long timeId,
String attribute)
A graph attribute was removed.
|
void |
graphCleared(String sourceId,
long timeId)
The whole graph was cleared.
|
boolean |
isAutoCreationEnabled()
Is the automatic creation of missing elements enabled?.
|
boolean |
isStrict()
Is strict checking enabled?
|
Iterator<Node> |
iterator()
This implementation returns
getNodeIterator() |
void |
nodeAdded(String sourceId,
long timeId,
String nodeId)
A node was inserted in the given graph.
|
void |
nodeAttributeAdded(String sourceId,
long timeId,
String nodeId,
String attribute,
Object value)
A node attribute was added.
|
void |
nodeAttributeChanged(String sourceId,
long timeId,
String nodeId,
String attribute,
Object oldValue,
Object newValue)
A node attribute was changed.
|
void |
nodeAttributeRemoved(String sourceId,
long timeId,
String nodeId,
String attribute)
A node attribute was removed.
|
NodeFactory<? extends Node> |
nodeFactory()
The factory used to create node instances.
|
void |
nodeRemoved(String sourceId,
long timeId,
String nodeId)
A node was removed from the graph.
|
boolean |
nullAttributesAreErrors()
If true, when accessing an attribute that does not exist (or is not of
the expected type), a
NullAttributeException is thrown. |
void |
read(FileSource input,
String filename)
Utility method to read a graph using the given reader.
|
void |
read(String filename)
Utility method to read a graph.
|
void |
removeAttributeSink(AttributeSink sink)
Remove an attribute sink.
|
<T extends Edge> |
removeEdge(Edge edge)
Removes an edge.
|
<T extends Edge> |
removeEdge(int index)
Removes an edge with a given index.
|
<T extends Edge> |
removeEdge(int fromIndex,
int toIndex)
Removes an edge between two nodes.
|
<T extends Edge> |
removeEdge(Node node1,
Node node2)
Removes an edge between two nodes.
|
<T extends Edge> |
removeEdge(String id)
Removes an edge knowing its identifier.
|
<T extends Edge> |
removeEdge(String from,
String to)
Remove an edge given the identifiers of its two endpoints.
|
void |
removeElementSink(ElementSink sink)
Remove an element sink.
|
<T extends Node> |
removeNode(int index)
Removes a node with a given index.
|
<T extends Node> |
removeNode(Node node)
Removes a node.
|
<T extends Node> |
removeNode(String id)
Remove a node using its identifier.
|
void |
removeSink(Sink sink)
Remove a sink.
|
void |
setAutoCreate(boolean on)
Enable or disable the automatic creation of missing elements.
|
void |
setEdgeFactory(EdgeFactory<? extends Edge> ef)
Set the edge factory used to create edges.
|
void |
setNodeFactory(NodeFactory<? extends Node> nf)
Set the node factory used to create nodes.
|
void |
setNullAttributesAreErrors(boolean on)
Should a
NullAttributeException be thrown when one tries to
access a non existing attribute, or an attribute whose type is not the
expected one?. |
void |
setStrict(boolean on)
Enable or disable strict checking.
|
void |
stepBegins(double time)
Since dynamic graphs are based on discrete event modifications, the
notion of step is defined to simulate elapsed time between events.
|
void |
stepBegins(String sourceId,
long timeId,
double step)
Since dynamic graphs are based on discrete event modifications, the
notion of step is defined to simulate elapsed time between events.
|
void |
write(FileSink output,
String filename)
Utility method to write a graph in the chosen format to a file.
|
void |
write(String filename)
Utility method to write a graph in DGS format to a file.
|
addAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttributepublic AbstractGraph(String id)
AbstractGraph(id, true, false)id - Identifier of the graphAbstractGraph(String, boolean, boolean)public AbstractGraph(String id, boolean strictChecking, boolean autoCreate)
id - strictChecking - autoCreate - public boolean nullAttributesAreErrors()
GraphNullAttributeException is thrown. Else null
is returned.nullAttributesAreErrors in interface Graphpublic abstract <T extends Node> T getNode(String id)
Graph
ExtendedNode node = graph.getNode("...");
the method will return an ExtendedNode node. If no left part exists,
method will just return a Node.public abstract <T extends Node> T getNode(int index)
GraphExtendedNode node = graph.getNode(index);the method will return an ExtendedNode node. If no left part exists, method will just return a Node.
public abstract <T extends Edge> T getEdge(String id)
Graph
ExtendedEdge edge = graph.getEdge("...");
the method will return an ExtendedEdge edge. If no left part exists,
method will just return an Edge.public abstract <T extends Edge> T getEdge(int index)
GraphExtendedEdge edge = graph.getEdge(index);the method will return an ExtendedEdge edge. If no left part exists, method will just return an Edge.
public abstract int getNodeCount()
StructuregetNodeCount in interface Structurepublic abstract int getEdgeCount()
StructuregetEdgeCount in interface Structurepublic abstract <T extends Node> Iterator<T> getNodeIterator()
StructureIterator<ExtendedNode> ite = graph.getNodeIterator();the method will return an Iterator<ExtendedNode>. If no left part exists, method will just return an Iterator<Node>.
getNodeIterator in interface Structurepublic abstract <T extends Edge> Iterator<T> getEdgeIterator()
StructureIterator<ExtendedEdge> ite = graph.getEdgeIterator();the method will return an Iterator<ExtendedEdge>. If no left part exists, method will just return an Iterator<Edge>.
getEdgeIterator in interface Structurepublic <T extends Node> Iterable<? extends T> getEachNode()
getNodeIterator()getEachNode in interface StructureStructure.getEachNode()public <T extends Edge> Iterable<? extends T> getEachEdge()
getEdgeIterator()getEachEdge in interface StructureStructure.getEachEdge()public <T extends Node> Collection<T> getNodeSet()
getNodeIterator() and
getNodeCount()getNodeSet in interface StructureStructure.getNodeSet()public <T extends Edge> Collection<T> getEdgeSet()
getEdgeIterator() and
getEdgeCount()getEdgeSet in interface StructureStructure.getNodeSet()public Iterator<Node> iterator()
getNodeIterator()iterator in interface Iterable<Node>Iterable.iterator()public NodeFactory<? extends Node> nodeFactory()
GraphnodeFactory in interface GraphGraph.setNodeFactory(NodeFactory),
Graph.edgeFactory()public EdgeFactory<? extends Edge> edgeFactory()
GraphedgeFactory in interface GraphGraph.setEdgeFactory(EdgeFactory),
Graph.nodeFactory()public void setNodeFactory(NodeFactory<? extends Node> nf)
GraphsetNodeFactory in interface Graphnf - the new NodeFactorypublic void setEdgeFactory(EdgeFactory<? extends Edge> ef)
GraphsetEdgeFactory in interface Graphef - the new EdgeFactorypublic boolean isStrict()
Graphpublic boolean isAutoCreationEnabled()
GraphisAutoCreationEnabled in interface Graphpublic double getStep()
Graphpublic void setNullAttributesAreErrors(boolean on)
GraphNullAttributeException be thrown when one tries to
access a non existing attribute, or an attribute whose type is not the
expected one?.setNullAttributesAreErrors in interface Graphon - if true, exceptions will be thrown when accessing a non
existing attribute.public void setStrict(boolean on)
GraphsetStrict in interface Graphon - True or false.Graph.isStrict()public void setAutoCreate(boolean on)
GraphsetAutoCreate in interface Graphon - True or false.Graph.isAutoCreationEnabled()public void stepBegins(double time)
GraphSince dynamic graphs are based on discrete event modifications, the notion of step is defined to simulate elapsed time between events. So a step is a event that occurs in the graph, it does not modify it but it gives a kind of timestamp that allows the tracking of the progress of the graph over the time.
This kind of event is useful for dynamic algorithms that listen to the dynamic graph and need to measure the time in the graph's evolution.
stepBegins in interface Graphtime - A numerical value that may give a timestamp to track the
evolution of the graph over the time.public void clear()
Graphclear in interface GraphSource.clearSinks()public <T extends Node> T addNode(String id)
Graph
This acts as a factory, creating the node instance automatically (and
eventually using the node factory provided). An event is generated toward
the listeners. If strict checking is enabled, and a node already exists
with this identifier, an
IdAlreadyInUseException is raised. Else the
error is silently ignored and the already existing node is returned.
This method is implicitly generic and returns something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = graph.addNode("...");
the method will return an ExtendedNode. If no left part exists, method
will just return a Node.
public <T extends Edge> T addEdge(String id, String node1, String node2)
GraphThe behavior of this method depends on many conditions. It can be summarized as follows.
First of all, the method checks if the graph already contains an edge
with the same id. If this is the case and strict checking is enabled,
IdAlreadyInUseException is thrown. If the strict checking is
disabled the method returns a reference to the existing edge if it has
endpoints node1 and node2 (in the same order if the edge
is directed) or null otherwise.
In the case when the graph does not contain an edge with the same id, the
method checks if node1 and node2 exist. If one or both of
them do not exist, and strict checking is enabled, ElementNotFoundException is thrown. Otherwise if auto-creation is
disabled, the method returns null. If auto-creation is enabled,
the method creates the missing endpoints.
When the edge id is not already in use and the both endpoints exist (or
created), the edge can still be rejected. It may happen for example when
it connects two already connected nodes in a single graph. If the edge is
rejected, the method throws EdgeRejectedException if strict
checking is enabled or returns null otherwise. Finally, if the
edge is accepted, it is created using the corresponding edge factory and
a reference to it is returned.
An edge creation event is sent toward the listeners. If new nodes are created, the corresponding events are also sent to the listeners.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = graph.addEdge("...", "...", "...");
the method will return an ExtendedEdge. If no left part exists, method
will just return an Edge.
public <T extends Edge> T addEdge(String id, String from, String to, boolean directed)
GraphGraph.addEdge(String, String, String), but this edge can be
directed between the two given nodes. If directed, the edge goes in the
'from' -> 'to' direction. An event is sent toward the listeners.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.directed - Is the edge directed?null (see the
detailed description above)Graph.addEdge(String, String, String)public <T extends Edge> T addEdge(String id, int index1, int index2)
GraphGraph.addEdge(String, String, String) but the nodes are
identified by their indices.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.index1 - The first node indexindex2 - The second node indexnullGraph.addEdge(String, String, String)public <T extends Edge> T addEdge(String id, int fromIndex, int toIndex, boolean directed)
GraphGraph.addEdge(String, String, String, boolean) but the nodes are
identified by their indices.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.fromIndex - The second node indextoIndex - The first node indexdirected - Is the edge directed?nullGraph.addEdge(String, String, String)public <T extends Edge> T addEdge(String id, Node node1, Node node2)
GraphGraph.addEdge(String, String, String) but the node references are
given instead of node identifiers.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.node1 - The first nodenode2 - The second nodenullGraph.addEdge(String, String, String)public <T extends Edge> T addEdge(String id, Node from, Node to, boolean directed)
GraphGraph.addEdge(String, String, String, boolean) but the node
references are given instead of node identifiers.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.from - The first nodeto - The second nodedirected - Is the edge directed?nullGraph.addEdge(String, String, String)public <T extends Node> T removeNode(String id)
GraphAn event is generated toward the listeners. Note that removing a node may remove all edges it is connected to. In this case corresponding events will also be generated toward the listeners.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = graph.removeNode("...");
the method will return an ExtendedNode. If no left part exists, method
will just return a Node.
removeNode in interface Graphid - The unique identifier of the node to remove.public <T extends Node> T removeNode(int index)
GraphAn event is generated toward the listeners. Note that removing a node may remove all edges it is connected to. In this case corresponding events will also be generated toward the listeners.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = graph.removeNode(index);the method will return an ExtendedNode. If no left part exists, method will just return a Node.
removeNode in interface Graphindex - The index of the node to be removedpublic <T extends Node> T removeNode(Node node)
GraphAn event is generated toward the listeners. Note that removing a node may remove all edges it is connected to. In this case corresponding events will also be generated toward the listeners.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = graph.removeNode(...);the method will return an ExtendedNode. If no left part exists, method will just return a Node.
removeNode in interface Graphnode - The node to be removedpublic <T extends Edge> T removeEdge(String id)
GraphElementNotFoundException is raised. Otherwise the error is
silently ignored and null is returned.
This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = graph.removeEdge("...");
the method will return an ExtendedEdge. If no left part exists, method
will just return an Edge.
removeEdge in interface Graphid - Identifier of the edge to remove.public <T extends Edge> T removeEdge(int index)
GraphThis method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge edge = graph.removeEdge(i);the method will return an ExtendedEdge edge. If no left part exists, method will just return an Edge.
removeEdge in interface Graphindex - The index of the edge to be removed.public <T extends Edge> T removeEdge(Edge edge)
GraphThis method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = graph.removeEdge(...);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
removeEdge in interface Graphedge - The edge to be removedpublic <T extends Edge> T removeEdge(String from, String to)
GraphIf the edge is directed it is removed only if its source and destination nodes are identified by 'from' and 'to' respectively. If the graph is a multi-graph and there are several edges between the two nodes, one of the edges at random is removed. An event is sent toward the listeners. If strict checking is enabled and at least one of the two given nodes does not exist or if they are not connected, a not found exception is raised. Else the error is silently ignored, and null is returned.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = graph.removeEdge("...", "...");
the method will return an ExtendedEdge. If no left part exists, method
will just return an Edge.
removeEdge in interface Graphfrom - The origin node identifier to select the edge.to - The destination node identifier to select the edge.public <T extends Edge> T removeEdge(int fromIndex, int toIndex)
GraphGraph.removeEdge(String, String) but the nodes are identified by their
indices.removeEdge in interface GraphfromIndex - the index of the source nodetoIndex - the index of the target nodenull if no edge is removedGraph.removeEdge(String, String)public <T extends Edge> T removeEdge(Node node1, Node node2)
GraphGraph.removeEdge(String, String) but node references are given instead
of node identifiers.removeEdge in interface Graphnode1 - the first nodenode2 - the second nodenull if no edge is removedGraph.removeEdge(String, String)public Iterable<AttributeSink> attributeSinks()
GraphAttributeSink objects registered to this
graph.attributeSinks in interface GraphAttributeSink under the form of an iterable
object.public Iterable<ElementSink> elementSinks()
GraphElementSink objects registered to this
graph.elementSinks in interface GraphElementSink under the form of an iterable
object.public void addAttributeSink(AttributeSink sink)
SourceaddAttributeSink in interface Sourcesink - The sink to register.public void addElementSink(ElementSink sink)
SourceaddElementSink in interface Sourcesink - The sink to register.public void addSink(Sink sink)
Sourcepublic void clearAttributeSinks()
SourceclearAttributeSinks in interface Sourcepublic void clearElementSinks()
SourceclearElementSinks in interface Sourcepublic void clearSinks()
SourceclearSinks in interface Sourcepublic void removeAttributeSink(AttributeSink sink)
SourceremoveAttributeSink in interface Sourcesink - The sink to remove, if it does not exist, this is ignored
silently.public void removeElementSink(ElementSink sink)
SourceremoveElementSink in interface Sourcesink - The sink to remove, if it does not exist, this is ignored
silently.public void removeSink(Sink sink)
SourceremoveSink in interface Sourcesink - The sink to remove, if it does not exist, this is ignored
silently.public void edgeAttributeAdded(String sourceId, long timeId, String edgeId, String attribute, Object value)
AttributeSinkedgeAttributeAdded in interface AttributeSinksourceId - Identifier of the graph where the change occurred.edgeId - Identifier of the edge whose attribute changed.attribute - The attribute name.value - The attribute new value.public void edgeAttributeChanged(String sourceId, long timeId, String edgeId, String attribute, Object oldValue, Object newValue)
AttributeSinkedgeAttributeChanged in interface AttributeSinksourceId - Identifier of the graph where the change occurred.edgeId - Identifier of the edge whose attribute changed.attribute - The attribute name.oldValue - The attribute old value.newValue - The attribute new value.public void edgeAttributeRemoved(String sourceId, long timeId, String edgeId, String attribute)
AttributeSinkedgeAttributeRemoved in interface AttributeSinksourceId - Identifier of the graph where the attribute was removed.edgeId - Identifier of the edge whose attribute was removed.attribute - The removed attribute name.public void graphAttributeAdded(String sourceId, long timeId, String attribute, Object value)
AttributeSinkgraphAttributeAdded in interface AttributeSinksourceId - Identifier of the graph where the attribute changed.attribute - The attribute name.value - The attribute new value.public void graphAttributeChanged(String sourceId, long timeId, String attribute, Object oldValue, Object newValue)
AttributeSinkgraphAttributeChanged in interface AttributeSinksourceId - Identifier of the graph where the attribute changed.attribute - The attribute name.oldValue - The attribute old value.newValue - The attribute new value.public void graphAttributeRemoved(String sourceId, long timeId, String attribute)
AttributeSinkgraphAttributeRemoved in interface AttributeSinksourceId - Identifier of the graph where the attribute was removed.attribute - The removed attribute name.public void nodeAttributeAdded(String sourceId, long timeId, String nodeId, String attribute, Object value)
AttributeSinknodeAttributeAdded in interface AttributeSinksourceId - Identifier of the graph where the change occurred.nodeId - Identifier of the node whose attribute changed.attribute - The attribute name.value - The attribute new value.public void nodeAttributeChanged(String sourceId, long timeId, String nodeId, String attribute, Object oldValue, Object newValue)
AttributeSinknodeAttributeChanged in interface AttributeSinksourceId - Identifier of the graph where the change occurred.nodeId - Identifier of the node whose attribute changed.attribute - The attribute name.oldValue - The attribute old value.newValue - The attribute new value.public void nodeAttributeRemoved(String sourceId, long timeId, String nodeId, String attribute)
AttributeSinknodeAttributeRemoved in interface AttributeSinksourceId - Identifier of the graph where the attribute was removed.nodeId - Identifier of the node whose attribute was removed.attribute - The removed attribute name.public void edgeAdded(String sourceId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed)
ElementSinkedgeAdded in interface ElementSinksourceId - Identifier of the graph where the edge was added.edgeId - Identifier of the added edge.fromNodeId - Identifier of the first node of the edge.toNodeId - Identifier of the second node of the edge.directed - If true, the edge is directed.public void edgeRemoved(String sourceId, long timeId, String edgeId)
ElementSinkedgeRemoved in interface ElementSinksourceId - The graph where the edge will be removed.edgeId - The edge that will be removed.public void graphCleared(String sourceId, long timeId)
ElementSinkgraphCleared in interface ElementSinksourceId - The graph cleared.public void nodeAdded(String sourceId, long timeId, String nodeId)
ElementSinknodeAdded in interface ElementSinksourceId - Identifier of the graph where the node was added.nodeId - Identifier of the added node.public void nodeRemoved(String sourceId, long timeId, String nodeId)
ElementSinknodeRemoved in interface ElementSinksourceId - Identifier of the graph where the node will be removed.nodeId - Identifier of the removed node.public void stepBegins(String sourceId, long timeId, double step)
ElementSinkSince dynamic graphs are based on discrete event modifications, the notion of step is defined to simulate elapsed time between events. So a step is a event that occurs in the graph, it does not modify it but it gives a kind of timestamp that allow the tracking of the progress of the graph over the time.
This kind of event is useful for dynamic algorithms that listen to the dynamic graph and need to measure the time in the graph's evolution.
stepBegins in interface ElementSinksourceId - Identifier of the graph where the step starts.timeId - A numerical value that may give a timestamp to track the
evolution of the graph over the time.public Viewer display()
Graphdisplay in interface GraphViewer,
Graph.display(boolean )public Viewer display(boolean autoLayout)
Graphdisplay in interface GraphautoLayout - If true a layout algorithm is launched in its own thread to
compute best node positions.Viewer,
Graph.display()public void read(FileSource input, String filename) throws IOException, GraphParseException
Graphread in interface Graphinput - An appropriate reader for the filename.filename - The graph filename (or URL).IOException - If an input/output error occurs during the graph reading.GraphParseException - If there is a parsing error while reading the file.public void read(String filename) throws IOException, GraphParseException, ElementNotFoundException
Graphread in interface Graphfilename - The graph filename (or URL).IOException - If an input output error occurs during the graph reading.GraphParseException - If there is a parsing error while reading the file.ElementNotFoundException - If the file cannot be found or if the format is not
recognized.public void write(FileSink output, String filename) throws IOException
Graphwrite in interface Graphoutput - The output format to use.filename - The file that will contain the saved graph (or URL).IOException - If an input/output error occurs during the graph writing.public void write(String filename) throws IOException
Graphwrite in interface Graphfilename - The file that will contain the saved graph (or URL).IOException - If an input/output error occurs during the graph writing.public Replayable.Controller getReplayController()
ReplayablegetReplayController in interface ReplayableCopyright © 2015. All rights reserved.