Package org.geotools.graph.build
Interface GraphBuilder
-
- All Known Implementing Classes:
BasicDirectedGraphBuilder
,BasicDirectedLineGraphBuilder
,BasicGraphBuilder
,BasicLineGraphBuilder
,OptDirectedGraphBuilder
,OptDirectedLineGraphBuilder
,OptGraphBuilder
,OptLineGraphBuilder
public interface GraphBuilder
Build the physical components of a Graph. The GraphBuilder manages the details of component creation, addition, and removal from the graph.
Graph components are created through calls to buildNode() and buildEdge(Node, Node), and then added to the graph through calls to addNode(Node), and addEdge(Edge).
The GraphBuilder class is the lower level of the graph construction process. The builder does not manage the entities being modelled by the graph components. This is done at a higher level by the GraphGenerator. class.- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
Graph
,GraphGenerator
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEdge(Edge edge)
Adds an edge to the graph.void
addNode(Node node)
Adds a node to the graph.Edge
buildEdge(Node nodeA, Node nodeB)
Builds a new edge for the graph.Node
buildNode()
Builds a new node for the graph.Object
clone(boolean deep)
Returns a clone of the builder.Graph
getGraph()
Returns the graph being built.void
importGraph(Graph g)
Constructs a graph builder from a pre built graph.void
removeEdge(Edge edge)
Removes an edge from the graph.void
removeEdges(Collection edges)
Removes a collection of edges from the graph.void
removeNode(Node node)
Removes an node from the graph.void
removeNodes(Collection nodes)
Removes a collection of nodes from the graph.
-
-
-
Method Detail
-
getGraph
Graph getGraph()
Returns the graph being built.- Returns:
- Graph The graph being built.
-
buildNode
Node buildNode()
Builds a new node for the graph. This method does not add the new node to the graph, this must be done with the addNode(Node) method.- Returns:
- Node The newly built node.
-
buildEdge
Edge buildEdge(Node nodeA, Node nodeB)
Builds a new edge for the graph. This method does not add the new node to the graph, this must be done with the addEdge(Edge) method.- Parameters:
nodeA
- Adjacent node to edge.nodeB
- Adjacent node to edge.- Returns:
- Edge the newly built Edge.
-
addNode
void addNode(Node node)
Adds a node to the graph.- Parameters:
node
- Node to be added to graph.
-
addEdge
void addEdge(Edge edge)
Adds an edge to the graph.- Parameters:
edge
- Edge to be added to graph.
-
removeNode
void removeNode(Node node)
Removes an node from the graph.- Parameters:
node
- Node to be removed from graph.
-
removeNodes
void removeNodes(Collection nodes)
Removes a collection of nodes from the graph.- Parameters:
nodes
- A collection of nodes to be removed from the graph.
-
removeEdge
void removeEdge(Edge edge)
Removes an edge from the graph.- Parameters:
edge
- Edge to be removed from graph.
-
removeEdges
void removeEdges(Collection edges)
Removes a collection of edges from the graph.- Parameters:
edges
- Collection of edges to be removed from the graph.
-
clone
Object clone(boolean deep) throws Exception
Returns a clone of the builder. A deep clone copies the underlying graph structure, a non deep clone results in an empty builder- Parameters:
deep
- Deep or non deep clone.- Returns:
- A graph builder.
- Throws:
Exception
-
importGraph
void importGraph(Graph g)
Constructs a graph builder from a pre built graph. The nodes and edges of the existing graph are imported into the builder. Relationships between nodes and edges are assummed to be preexistant.- Parameters:
g
- A pre built graph.
-
-