public interface IGraph
Modifier and Type | Method and Description |
---|---|
boolean |
addEdge(int u,
int v,
double weight)
Adds a new arc between the vertex u and the vertex v with a weight
This method does not test if the edge already exists in the graph.
|
IList<InfoPath> |
bfs(int u)
It is a technique for traversing a tree, called Breadth first search
|
boolean |
deleteEdge(int u,
int v)
Deletes an arc with the vertex u as origin and the vertex v as destination
|
boolean |
deleteVertex(int v)
Deletes a vertex
|
IList<InfoPath> |
dfs(int u)
It is a technique for traversing a tree, called Depth first search
|
void |
drawDataType(java.lang.String path,
java.lang.Class clase)
Generates a PNG and a DOT file with a figure representing structure the
object
|
int |
getCost()
Gets the cost of the last operation performed
|
IList<java.lang.Integer> |
getNeighbors(int u)
Returns a list with all the vertices that have an arc with the vertex u as
the origin
|
int |
getNumEdges()
Returns the number of edges
|
int |
getNumVertices()
Returns the number of vertices
|
double |
getWeightEdge(int u,
int v)
Returns the weight of an arc
|
boolean |
hasEdge(int u,
int v)
Returns true if exists an arc between the vertex u and the vertex v, if
not it returns false
|
java.lang.String |
info()
Returns a string with information of the graph the string contains if the
graph is directed, if is weighted, the number of vertices and the number
of arcs
|
boolean |
isDirected()
Returns if a vertex is directed or not
|
boolean |
isWeighted()
Returns if a vertex is heavy or not
|
int |
rankVertex(int u)
Returns the number of arcs with the vertex u as origin
|
void |
saveGraph(java.lang.String fich)
Saves the information of the graph into a file, so that you can
reconstruct the graph with this file
|
int getNumVertices()
int getNumEdges()
boolean addEdge(int u, int v, double weight)
u
- , the vertex originv
- , the vertex destinationweight
- , the weight of the new arcIList<java.lang.Integer> getNeighbors(int u)
u
- , the vertex originboolean hasEdge(int u, int v)
u
- , the vertex originv
- , the vertex destinationint rankVertex(int u)
u
- , the vertex originjava.lang.String info()
boolean deleteEdge(int u, int v)
u
- , the vertex originv
- , the vertex destinationboolean deleteVertex(int v)
v
- , the vertex to deletedouble getWeightEdge(int u, int v)
u
- , the vertex originv
- , the vertex destinationboolean isDirected()
boolean isWeighted()
IList<InfoPath> bfs(int u)
u
- , contains the position of the element that must be the first in
the traversingIList<InfoPath> dfs(int u)
u
- , contains the position of the element that must be the first in
the traversingvoid saveGraph(java.lang.String fich) throws java.io.IOException
fich
- the name of the filejava.io.IOException
int getCost()
void drawDataType(java.lang.String path, java.lang.Class clase)
path
- the path where generate the DOT file