|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javanetworkanalyzer.graphcreators.GraphCreator<V,E>
org.javanetworkanalyzer.graphcreators.WeightedGraphCreator<V,E>
public class WeightedGraphCreator<V extends VId,E extends Edge>
Creates weighted JGraphT graphs from a csv file produced by OrbisGIS.
| Field Summary | |
|---|---|
protected static int |
weightFieldIndex
Weight index. |
| Fields inherited from class org.javanetworkanalyzer.graphcreators.GraphCreator |
|---|
DIRECTED, DOUBLE_QUOTES, edgeClass, EMPTY_STRING, END_NODE, endNodeIndex, orientation, REVERSED, SEPARATOR, START_NODE, startNodeIndex, UNDIRECTED, vertexClass |
| Constructor Summary | |
|---|---|
WeightedGraphCreator(String csvFile,
int orientation,
Class<? extends V> vertexClass,
Class<? extends E> edgeClass,
String weightField)
Initializes a new WeightedGraphCreator. |
|
| Method Summary | |
|---|---|
protected KeyedGraph<V,E> |
initializeGraph()
Initializes a graph. |
protected void |
initializeIndices(Scanner scanner)
Initialize the start node, end node, and weight indices by reading the first line of the csv file. |
protected E |
loadEdge(String[] row,
KeyedGraph<V,E> graph,
boolean reverse)
Loads a weighted edge into the graph. |
WeightedKeyedGraph<V,E> |
loadGraph()
Returns a new graph from a csv file produced in OrbisGIS as the output.edges table given by ST_Graph. |
| Methods inherited from class org.javanetworkanalyzer.graphcreators.GraphCreator |
|---|
deleteDoubleQuotes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static int weightFieldIndex
| Constructor Detail |
|---|
public WeightedGraphCreator(String csvFile,
int orientation,
Class<? extends V> vertexClass,
Class<? extends E> edgeClass,
String weightField)
WeightedGraphCreator.
csvFile - CSV file containing the edge information.weightField - The weight column name.orientation - The desired graph orientation.| Method Detail |
|---|
public WeightedKeyedGraph<V,E> loadGraph()
throws FileNotFoundException,
NoSuchMethodException
GraphCreatoroutput.edges table given by ST_Graph.
loadGraph in class GraphCreator<V extends VId,E extends Edge>FileNotFoundException
NoSuchMethodExceptionprotected void initializeIndices(Scanner scanner)
initializeIndices in class GraphCreator<V extends VId,E extends Edge>scanner - The scanner that will read the first line of the csv file.
protected KeyedGraph<V,E> initializeGraph()
throws NoSuchMethodException
GraphCreator
initializeGraph in class GraphCreator<V extends VId,E extends Edge>NoSuchMethodException - If the vertex class does not have a
constructor with just an Integer parameter.
protected E loadEdge(String[] row,
KeyedGraph<V,E> graph,
boolean reverse)
loadEdge in class GraphCreator<V extends VId,E extends Edge>row - The row from which to load the edge.graph - The graph to which the edges will be added.reverse - true iff the edge orientation should be reversed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||