org.grinvin.graphs
Interface Graph
- GraphView
- MutableGraphModel, UndoableGraph
- DefaultGraph, DefaultGraphModel
A mutable version of
GraphView
. Provides methods to add and remove
vertices and edges in the graph.
Edge | addNewEdge(Vertex firstEndpoint, Vertex secondEndpoint) - Add a new edge to the graph which joins the given (existing) vertices.
|
Vertex | addNewVertex() - Create a new vertex and add it to the graph.
|
void | clear() - Remove all vertices and all edges from this graph.
|
void | copy(GraphView original) - Make this graph a copy of the given view.
|
void | remove(Edge e) - Remove the given edge from the graph.
|
void | remove(Vertex v) - Remove the given vertex from the graph.
|
areAdjacent , contains , contains , edgeIterator , edges , getEdge , getNumberOfEdges , getNumberOfVertices , getVertex , vertexIterator , vertices |
addNewEdge
public Edge addNewEdge(Vertex firstEndpoint,
Vertex secondEndpoint)
Add a new edge to the graph which joins the given (existing) vertices.
addNewVertex
public Vertex addNewVertex()
Create a new vertex and add it to the graph. The index of this
newly created vertex should be equal to the number of vertices
in the graph before that vertex was added.
- the newly created vertex.
clear
public void clear()
Remove all vertices and all edges from this graph.
copy
public void copy(GraphView original)
Make this graph a copy of the given view. Corresponding vertices will have
the same index in the copy as in the original. This graph will be cleared
prior to the copy operation.
remove
public void remove(Edge e)
Remove the given edge from the graph.
remove
public void remove(Vertex v)
Remove the given vertex from the graph. Also removes all
edges incident with this vertex. Removing a vertex makes its index negative
and may change the indices of other vertices in the same graph.