|
Routify Documentation
|
Public Member Functions | |
| CustomGraph (Class<? extends E > edgeClass) | |
| E | addEdge (V sourceVertex, V targetVertex) |
| CustomVertex | nearestVertex (V from) throws Exception |
| void | exportGexf () throws IOException, XMLStreamException, FactoryConfigurationError, SaxonApiException |
| void | exportGexf (OutputStream out) throws IOException, XMLStreamException, FactoryConfigurationError, SaxonApiException |
| void | prune () |
| void | mergeVertices (V v1, V v2) throws Exception |
A generic class that extends SimpleDirectedWeightedGraph to manage and manipulate graphs. It provides functionalities such as adding edges, finding the nearest vertex, exporting the graph in GEXF format, and cleaning up disjoint sets.
| <V> | the vertex class, which should extend CustomVertex |
| <E> | the edge class, which should extend CustomEdge |
|
inline |
Constructs a CustomGraph with the specified edge class.
| edgeClass | the class of edges to be used in the graph |
|
inline |
Adds an edge between source and target vertices. Prints a message if either vertex is null.
| sourceVertex | the source vertex of the edge |
| targetVertex | the target vertex of the edge |
|
inline |
Exports the graph to a GEXF file with a default filename based on the current date.
| IOException | if an I/O error occurs |
| XMLStreamException | if an error occurs while processing the XML |
| FactoryConfigurationError | if a configuration error occurs |
| SaxonApiException | if an error occurs while using the Saxon API |
|
inline |
Exports the graph to a GEXF file using a custom output stream.
| out | the output stream to which the graph is exported |
| IOException | if an I/O error occurs |
| XMLStreamException | if an error occurs while processing the XML |
| FactoryConfigurationError | if a configuration error occurs |
| SaxonApiException | if an error occurs while using the Saxon API |
|
inline |
|
inline |
Finds the nearest vertex to the given vertex.
| from | the vertex from which to search |
| Exception | if the nearest vertex is more than 500 meters away |
|
inline |
Prunes the graph to retain only the nodes belonging to its largest connected component. This method operates in several steps:
After execution, the graph will only contain nodes and edges that are part of the largest connected component. This method can significantly alter the graph structure and should be used with caution.
| RuntimeException | If no connected components can be found in the graph, indicating an empty or improperly initialized graph. |