public class Graph extends Object
| Constructor and Description |
|---|
Graph() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEdge(Edge edge) |
void |
addEdge(String from,
String to) |
void |
addNode(Node node) |
Set<Edge> |
findEdges(Node node)
Find all edges that are connected to the specific node, both as an outgoing
Edge.getFrom() or incoming
Edge.getTo() end point. |
Set<Edge> |
findEdgesFrom(Node from)
Find all edges that are connected
Edge.getFrom() the specific node. |
Set<Edge> |
getEdges() |
Node |
getNodeByName(String name)
Get the Node by Name.
|
Set<Node> |
getNodes() |
Path |
getPath(Node from,
Node to)
Using BFS (Breadth First Search) return the path from a any arbitrary node to any other.
|
Path |
getPath(String nodeNameOrigin,
String nodeNameDest)
Convenience method for
getPath(Node, Node) |
void |
insertNode(Edge edge,
Node node)
Insert an arbitrary node on an existing edge.
|
void |
insertNode(Edge edge,
String nodeName)
Convenience method for
insertNode(Edge, Node) |
void |
removeEdge(Edge edge) |
void |
removeEdge(String fromNodeName,
String toNodeName) |
void |
removeNode(Node node) |
void |
setEdges(Set<Edge> edges) |
void |
setNodes(Set<Node> nodes) |
public void addEdge(Edge edge)
public void addNode(Node node)
public void insertNode(Edge edge, String nodeName)
insertNode(Edge, Node)edge - the edge to split and insert a node intonodeName - the name of the node to insert along the edgepublic void insertNode(Edge edge, Node node)
edge - the edge to split and insert a node intonode - the node to insert along the edgepublic Set<Edge> findEdges(Node node)
Edge.getFrom() or incoming
Edge.getTo() end point.node - the node with potential end pointspublic Set<Edge> findEdgesFrom(Node from)
Edge.getFrom() the specific node.from - the node with potential edges from itpublic Path getPath(String nodeNameOrigin, String nodeNameDest)
getPath(Node, Node)nodeNameOrigin - the name of the node to the path origin.nodeNameDest - the name of the node to the path destination.public Path getPath(Node from, Node to)
from - the node fromto - the node topublic Node getNodeByName(String name)
name - the name to lookuppublic void removeEdge(Edge edge)
public void removeNode(Node node)
Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.