lu.cs.co.graph
Class Miles
java.lang.Object
|
+--lu.cs.co.graph.Graph
|
+--lu.cs.co.graph.Miles
- public class Miles
- extends Graph
- implements Embedding
Constructor for undirected graphs based on US mileage data. Each
vertex of the graph corresponds to a city, each edge to the
intercity highway distance. The edges satisfy the triangle
inequality.
| Fields inherited from class lu.cs.co.graph.Graph |
m,
n,
name |
|
Constructor Summary |
Miles()
The complete graph including all cities. |
Miles(int numCities)
The complete graph on a specified number of large cities. |
Miles(int numCities,
int maxDistance)
A graph on a specified number of cities and with sufficiently short
edges. |
Miles(int numCities,
int maxDistance,
int maxDegree)
A graph on a specified number of cities, with sufficiently short
edges and low degree. |
Miles(int numCities,
int northWeight,
int westWeight,
int popWeight,
int maxDistance,
int maxDegree,
int seed)
General constructor for intercity mileage graphs. |
| Methods inherited from class lu.cs.co.graph.Graph |
degree,
edges,
findByName,
getAdjecencyMatrix,
getDistanceMatrix,
getEdge,
getIndex,
getVertex,
getVertex,
hasEdge,
incident,
incoming,
indegree,
index,
isDirected,
main,
outdegree,
outgoing,
parseGraph,
toString,
vertices |
Miles
public Miles()
- The complete graph including all cities.
Miles
public Miles(int numCities)
- The complete graph on a specified number of large cities.
- Parameters:
numCities - the number of cities.
Miles
public Miles(int numCities,
int maxDistance)
- A graph on a specified number of cities and with sufficiently short
edges.
- Parameters:
numCities - the number of citiesmaxDistance - upper bound on the length of included edges (in miles)
Miles
public Miles(int numCities,
int maxDistance,
int maxDegree)
- A graph on a specified number of cities, with sufficiently short
edges and low degree.
- Parameters:
numCities - the number of citiesmaxDistance - upper bound on the length of included edges (in miles)numDegree - upper bound on the degree of each vertex
Miles
public Miles(int numCities,
int northWeight,
int westWeight,
int popWeight,
int maxDistance,
int maxDegree,
int seed)
- General constructor for intercity mileage graphs. Cities are
in- or excluded depending on the value of
northWeight * lat +
westWeight * lon + popWeight * pop,
- Miles(n, 0, 0, 1, 0, 0,
0)
- constructs the n cities with the largest population
- Miles(n, 1, 0, 0, 0, 0, 0)
- constructs the n
northernmost cities
- Miles(n, -500, 0, 1, 0, 0, 0)
- constructs the n mostly southern cities, but includes
a few large northern ones, too.
If all three parameters
are 0, the cities are chosen uniformly at random.
- Parameters:
numCities - the number of citiesnorthWeight - if large, favours northern cities (must be in
the range -100000..100000)westWeight - if large, favours western cities (must be in
the range -100000..100000)northWeight - if large, favours populous cities (must be in
the range -100..100)maxDistance - upper bound on the length of included edges (in miles)numDegree - upper bound on the degree of each vertexseed - the seed used in all random choices
getBounds
public Rectangle getBounds()
- Specified by:
- getBounds in interface Embedding
emb
public Embedding.Point emb(Vertex v)
- Specified by:
- emb in interface Embedding