Inherits java::io::Serializable.
Classes | |
class | Edge |
class | Node |
Public Member Functions | |
Node | getAuxNode () |
void | setAuxNode (Node aux) |
int | getAuxInt () |
void | setAuxInt (int auxInt) |
Graph () | |
Node | newNode (int key) |
void | addNode (Node n) |
void | addEdge (Edge e) |
void | newUndirectedEdge (Node a, Node b) |
void | newUndirectedEdge (Node a, Node b, int cost) |
Edge | newEdge (Node a, Node b) |
Edge | newEdge (Node a, Node b, int cost) |
boolean | containsEdge (Node n1, Node n2) |
Node | findNode (int label) |
Node[] | nodes () |
Edge[] | edges () |
int | numEdges () |
int | numNodes () |
int | size () |
Set< Node > | getNeighbors (Node src) |
void | removeAllIncomingEdges (Node n) |
void | removeAllOutgoingEdges (Node n) |
Node[] | hamiltonian () |
Edge[] | hamiltonian2 () |
Edge[] | tsp (Node startNode, int maxCost) |
Node[] | topsort () |
Node[] | maxClique (int k) |
Map< Node, Integer > | color (int k) |
String | toString () |
Static Public Member Functions | |
static boolean | checkTSP (Graph g, Edge[] hamcycle, int maxCost) |
Private Attributes | |
Set< Node > | nodes = new LinkedHashSet<Node>() |
Set< Edge > | edges = new LinkedHashSet<Edge>() |
Node | auxNode |
int | auxInt |
Static Private Attributes | |
static final long | serialVersionUID = -6332798241722968023L |
An implementation of the Graph data structure, along with several graph algorithms.
Definition at line 28 of file Graph.java.
edu.mit.csail.sdg.squander.examples.graph.Graph.Graph | ( | ) |
Definition at line 145 of file Graph.java.
void edu.mit.csail.sdg.squander.examples.graph.Graph.addEdge | ( | Edge | e | ) |
Definition at line 154 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.edges().
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.newEdge().
void edu.mit.csail.sdg.squander.examples.graph.Graph.addNode | ( | Node | n | ) |
Definition at line 153 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.nodes().
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.newNode(), edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph1(), and edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph2().
static boolean edu.mit.csail.sdg.squander.examples.graph.Graph.checkTSP | ( | Graph | g, | |
Edge[] | hamcycle, | |||
int | maxCost | |||
) | [static] |
Definition at line 318 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.nodes.
Map<Node, Integer> edu.mit.csail.sdg.squander.examples.graph.Graph.color | ( | int | k | ) |
Graph k-Coloring problem
Definition at line 303 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testColor().
boolean edu.mit.csail.sdg.squander.examples.graph.Graph.containsEdge | ( | Node | n1, | |
Node | n2 | |||
) |
Definition at line 178 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.edges().
Definition at line 187 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.addEdge(), edu.mit.csail.sdg.squander.examples.graph.Graph.containsEdge(), edu.mit.csail.sdg.squander.examples.graph.Graph.getNeighbors(), edu.mit.csail.sdg.squander.examples.graph.Graph.numEdges(), edu.mit.csail.sdg.squander.examples.graph.Graph.removeAllIncomingEdges(), and edu.mit.csail.sdg.squander.examples.graph.Graph.removeAllOutgoingEdges().
Node edu.mit.csail.sdg.squander.examples.graph.Graph.findNode | ( | int | label | ) |
Definition at line 179 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.nodes().
int edu.mit.csail.sdg.squander.examples.graph.Graph.getAuxInt | ( | ) |
Definition at line 142 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.auxInt.
Node edu.mit.csail.sdg.squander.examples.graph.Graph.getAuxNode | ( | ) |
Definition at line 138 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.auxNode.
Set<Node> edu.mit.csail.sdg.squander.examples.graph.Graph.getNeighbors | ( | Node | src | ) |
Definition at line 193 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.edges().
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.checkColorsOk().
Node [] edu.mit.csail.sdg.squander.examples.graph.Graph.hamiltonian | ( | ) |
Spec for the Hamiltonian path problem
Definition at line 226 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph1().
Edge [] edu.mit.csail.sdg.squander.examples.graph.Graph.hamiltonian2 | ( | ) |
A different spec for the Hamiltonian path problem
Definition at line 242 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph1().
Node [] edu.mit.csail.sdg.squander.examples.graph.Graph.maxClique | ( | int | k | ) |
Max Clique
Definition at line 288 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph2().
Edge edu.mit.csail.sdg.squander.examples.graph.Graph.newEdge | ( | Node | a, | |
Node | b, | |||
int | cost | |||
) |
Definition at line 172 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.addEdge().
Edge edu.mit.csail.sdg.squander.examples.graph.Graph.newEdge | ( | Node | a, | |
Node | b | |||
) |
Definition at line 166 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.addEdge().
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.newUndirectedEdge(), edu.mit.csail.sdg.squander.examples.graph.GraphTest.testColor(), edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph1(), and edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph2().
Node edu.mit.csail.sdg.squander.examples.graph.Graph.newNode | ( | int | key | ) |
Definition at line 147 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.addNode().
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testColor(), and edu.mit.csail.sdg.squander.examples.graph.GraphTest.testTSP().
void edu.mit.csail.sdg.squander.examples.graph.Graph.newUndirectedEdge | ( | Node | a, | |
Node | b, | |||
int | cost | |||
) |
Definition at line 161 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.newEdge().
void edu.mit.csail.sdg.squander.examples.graph.Graph.newUndirectedEdge | ( | Node | a, | |
Node | b | |||
) |
Definition at line 156 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.newEdge().
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testColor(), and edu.mit.csail.sdg.squander.examples.graph.GraphTest.testTSP().
Definition at line 186 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.addNode(), edu.mit.csail.sdg.squander.examples.graph.Graph.findNode(), and edu.mit.csail.sdg.squander.examples.graph.Graph.numNodes().
int edu.mit.csail.sdg.squander.examples.graph.Graph.numEdges | ( | ) |
Definition at line 189 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.edges().
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph1(), and edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph2().
int edu.mit.csail.sdg.squander.examples.graph.Graph.numNodes | ( | ) |
Definition at line 190 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.nodes().
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.size(), and edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph1().
void edu.mit.csail.sdg.squander.examples.graph.Graph.removeAllIncomingEdges | ( | Node | n | ) |
Definition at line 201 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.edges().
void edu.mit.csail.sdg.squander.examples.graph.Graph.removeAllOutgoingEdges | ( | Node | n | ) |
Definition at line 208 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.edges().
void edu.mit.csail.sdg.squander.examples.graph.Graph.setAuxInt | ( | int | auxInt | ) |
Definition at line 143 of file Graph.java.
void edu.mit.csail.sdg.squander.examples.graph.Graph.setAuxNode | ( | Node | aux | ) |
Definition at line 139 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.auxNode.
int edu.mit.csail.sdg.squander.examples.graph.Graph.size | ( | ) |
Definition at line 191 of file Graph.java.
References edu.mit.csail.sdg.squander.examples.graph.Graph.numNodes().
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.checkColorsOk(), and edu.mit.csail.sdg.squander.examples.graph.HamiltonianMan.hp().
Node [] edu.mit.csail.sdg.squander.examples.graph.Graph.topsort | ( | ) |
Topological sort
Definition at line 274 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testGraph1().
String edu.mit.csail.sdg.squander.examples.graph.Graph.toString | ( | ) |
Definition at line 308 of file Graph.java.
Edge [] edu.mit.csail.sdg.squander.examples.graph.Graph.tsp | ( | Node | startNode, | |
int | maxCost | |||
) |
Traveling Salesman Problem
Definition at line 260 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.GraphTest.testTSP().
int edu.mit.csail.sdg.squander.examples.graph.Graph.auxInt [private] |
Definition at line 141 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.getAuxInt().
Node edu.mit.csail.sdg.squander.examples.graph.Graph.auxNode [private] |
Definition at line 137 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.getAuxNode(), and edu.mit.csail.sdg.squander.examples.graph.Graph.setAuxNode().
Set<Edge> edu.mit.csail.sdg.squander.examples.graph.Graph.edges = new LinkedHashSet<Edge>() [private] |
Definition at line 135 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.HamiltonianMan.hp().
Set<Node> edu.mit.csail.sdg.squander.examples.graph.Graph.nodes = new LinkedHashSet<Node>() [private] |
Definition at line 134 of file Graph.java.
Referenced by edu.mit.csail.sdg.squander.examples.graph.Graph.checkTSP().
final long edu.mit.csail.sdg.squander.examples.graph.Graph.serialVersionUID = -6332798241722968023L [static, private] |
Definition at line 30 of file Graph.java.