public class BasicGraph extends Object implements Graph, Serializable
Graph
,
Serialized FormFAIL_QUERY, PASS_AND_CONTINUE, PASS_AND_STOP
Constructor and Description 

BasicGraph()
Constructs an empty graph with edge and node collections uninitialized.

BasicGraph(Collection<Node> nodes,
Collection<Edge> edges)
Constructs a graph from a collection of nodes and a collection of edges.

Modifier and Type  Method and Description 

Collection<Edge> 
getEdges()
Returns the edges of the graph.

Collection<Node> 
getNodes()
Returns the nodes of the graph.

List<Node> 
getNodesOfDegree(int n)
Returns all the nodes in the graph of a specified degree.

List<Edge> 
getVisitedEdges(boolean visited)
Returns all the edges in the graph that have been marked as visited or nonvisited.

List<Node> 
getVisitedNodes(boolean visited)
Returns all the nodes in the graph that have been marked as visited or nonvisited.

void 
initEdges()
Initializes the edges in the graph by setting all visited flags to false and all visited
counts to zero.

void 
initNodes()
Initializes the nodes in the graph by setting all visited flags to false and all visited
counts to zero.

List<Edge> 
queryEdges(GraphVisitor visitor)
Performs a query against the edges of the graph.

List<Node> 
queryNodes(GraphVisitor visitor)
Performs a query against the nodes of the graph.

void 
setEdges(Collection<Edge> edges)
Sets the edge collection for the graph.

void 
setNodes(Collection<Node> nodes)
Sets the node collection of the graph.

String 
toString()
Returns the string representation of the graph which is just the string representation of the
edge and node collections.

void 
visitEdges(GraphVisitor visitor)
Applies the visitor pattern to the edges of the graph.

void 
visitNodes(GraphVisitor visitor)
Applies the visitor pattern to the nodes of the graph.

public BasicGraph()
public BasicGraph(Collection<Node> nodes, Collection<Edge> edges)
nodes
 Collection of nodes to be contained by the graph.edges
 Collection of edges to be contained by the graph.public void setNodes(Collection<Node> nodes)
nodes
 Collection of Node objects.public Collection<Node> getNodes()
Graph
getNodes
in interface Graph
Graph.getNodes()
public void setEdges(Collection<Edge> edges)
edges
 Collection of Edge objects.public Collection<Edge> getEdges()
Graph
getEdges
in interface Graph
Graph.getEdges()
public List<Node> queryNodes(GraphVisitor visitor)
Graph
queryNodes
in interface Graph
visitor
 Determines if node meets query criteria. Returns MEET_AND_CONTINUE to signal
that the node meets the query criteria and the query should continue.Graph.queryNodes(GraphVisitor)
public List<Edge> queryEdges(GraphVisitor visitor)
Graph
queryEdges
in interface Graph
visitor
 Determines if the meets the query criteria. Graph.queryEdges(GraphVisitor)
public void visitNodes(GraphVisitor visitor)
Graph
visitNodes
in interface Graph
Graph.visitNodes(GraphVisitor)
public void visitEdges(GraphVisitor visitor)
Graph
visitEdges
in interface Graph
Graph.visitEdges(GraphVisitor)
public List<Node> getNodesOfDegree(int n)
Graph
getNodesOfDegree
in interface Graph
n
 The desired degree of nodes to be returned.Graph.getNodesOfDegree(int)
,
Node.getDegree()
public List<Node> getVisitedNodes(boolean visited)
Graph
getVisitedNodes
in interface Graph
visited
 True if node is visited, false if node is unvisited.Graph.getVisitedNodes(boolean)
public List<Edge> getVisitedEdges(boolean visited)
Graph
getVisitedEdges
in interface Graph
visited
 True if edge is visited, false if edge is unvisited.Graph.getVisitedEdges(boolean)
public void initNodes()
public void initEdges()
Copyright © 1996–2019 Geotools. All rights reserved.