|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnanomunchers.graph.GraphFactory
The only way to build a new graph is through the Factory.
Constructor Summary | |
GraphFactory()
|
Method Summary | |
static Graph |
buildFromParts(Node[] nodes,
Edge[] edges)
Creats a new graph from a set of nodes and edges |
static Graph |
buildGridGraph(int width,
int height)
Builds a graph that resembles a city grid. |
static Graph |
buildRandomized(Graph src,
double chanceNodeRemoved)
Builds a graph with a random number of edges removed |
static Graph |
loadFile(java.lang.String name)
|
static Graph |
loadHttpURL(java.lang.String url)
Attempts to load a graph from anywhere in the web. |
static void |
saveFile(java.lang.String name,
Graph toSave)
Saves a given graph to a file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GraphFactory()
Method Detail |
public static Graph buildRandomized(Graph src, double chanceNodeRemoved)
src
- intial graph before removalchanceNodeRemoved
- 0.0 - 1.0 of removal
public static Graph buildFromParts(Node[] nodes, Edge[] edges)
nodes
- from a previous graphedges
- from a previous graph
public static Graph buildGridGraph(int width, int height)
width
- of the gridheight
- of the grid
public static void saveFile(java.lang.String name, Graph toSave) throws java.io.IOException
name
- of the file to savetoSave
- Graph data to save.
java.io.IOException
- related to file issuespublic static Graph loadHttpURL(java.lang.String url) throws java.io.IOException
url
- location of the graph
java.io.IOException
- any possible problems with the file or connection.public static Graph loadFile(java.lang.String name) throws java.io.FileNotFoundException
java.io.FileNotFoundException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |