diff --git a/README.md b/README.md index df8b692..7115f65 100644 Binary files a/README.md and b/README.md differ diff --git a/build.gradle b/build.gradle index f2ad5f6..bc2999e 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,13 @@ apply plugin: 'eclipse' version='1.0-SNAPSHOT' +jar { + manifest { + attributes 'Main-Class': 'berack96.lib.graph.view.Main' + } + from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } +} + test { useJUnitPlatform() } @@ -24,5 +31,5 @@ dependencies { compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5' /*compile group: 'commons-collections', name: 'commons-collections', version: '3.2'*/ - /*testCompile 'junit:junit:4.4'*/ + testCompile 'junit:junit:4.4' } \ No newline at end of file diff --git a/doc/allclasses-frame.html b/doc/allclasses-frame.html new file mode 100644 index 0000000..8841849 --- /dev/null +++ b/doc/allclasses-frame.html @@ -0,0 +1,53 @@ + + + +
+ +V - the verticesW - the weight of the edgepublic class Edge<V,W extends java.lang.Number>
+extends java.lang.Object
+| Constructor and Description | +
|---|
Edge(V source,
+ V destination,
+ W weight)
+Create an final version of this object
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+equals(java.lang.Object obj) |
+
V |
+getDestination()
+The vertex where the edge goes
+ |
+
V |
+getSource()
+The vertex where the edge starts from
+ |
+
W |
+getWeight()
+The weight of the edge
+ |
+
int |
+hashCode() |
+
java.lang.String |
+toString() |
+
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic V getDestination()+
public V getSource()+
public W getWeight()+
public java.lang.String toString()+
toString in class java.lang.Objectpublic int hashCode()+
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)+
equals in class java.lang.ObjectV - The Object that represent a vertexW - The Object that represent the edge (more specifically the weight of the edge)public interface Graph<V,W extends java.lang.Number>
+extends java.lang.Iterable<V>
+| Modifier and Type | +Field and Description | +
|---|---|
static com.google.gson.Gson |
+GSON |
+
static java.lang.String |
+NOT_CONNECTED |
+
static java.lang.String |
+NOT_DAG |
+
static java.lang.String |
+PARAM_NULL |
+
static java.lang.String |
+VERTEX_NOT_CONTAINED |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+addAllEdges(java.util.Collection<Edge<V,W>> edges)
+Add all the edges of the collection to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + Any null edges will be ignored. + This method will overwrite any existing edge between the two vertex. |
+
void |
+addAllVertices(java.util.Collection<V> vertices)
+Add all the vertices contained in the collection to the graph.
++ If a vertex is contained in the collection and in the graph is ignored and it will not be replaced. + Null vertices will be ignored and they will not be added to the graph. |
+
W |
+addEdge(Edge<V,W> edge)
+Add an edge between the two vertex.
++ The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdge(V vertex1,
+ V vertex2,
+ W weight)
+Add an edge between the two vertex.
++ The edge will be created from the vertex V1 and the vertex V2 + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdgeAndVertices(Edge<V,W> edge)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices of the edge aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdgeAndVertices(V vertex1,
+ V vertex2,
+ W weight)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex V1 and the vertex V2 + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
void |
+addVertex(V vertex)
+Add the vertex to the graph.
+ |
+
boolean |
+addVertexIfAbsent(V vertex)
+Add the specified vertex to the graph only if the graph doesn't contains it.
++ The graph contains a vertex only if the method contains(Object) returns true. |
+
boolean |
+contains(V vertex)
+Check if the vertex passed is contained in the graph or not.
++ The vertex V1 is contained in the graph G, if and only if: + exist V2 in G such that V2.equals(V1) |
+
boolean |
+containsEdge(V vertex1,
+ V vertex2)
+Check if the edge between the two vertex passed is contained in the graph or not.
++ An edge between V1 and V2 is contained in the graph if and only if i can travel from V1 to V2. + If one of the two vertices is not contained in the graph, then even the edge isn't |
+
int |
+degree(V vertex)
+Tells the degree of a vertex.
++ The degree of a vertex is the quantity of edges that have. + Basically, it'll count how many edge it have. |
+
int |
+degreeIn(V vertex)
+Tells the degree of all the edges that goes to this vertex.
++ Basically, it'll count how many edge towards himself it have. |
+
int |
+degreeOut(V vertex)
+Tells the degree of all the edges that goes form this vertex to others.
++ Basically, it'll count how many edge towards any other vertex it have. |
+
java.util.Map<V,java.util.List<Edge<V,W>>> |
+distance(V source)
+Get the minimum path from the source vertex to all the possible reachable vertices.
+ |
+
java.util.List<Edge<V,W>> |
+distance(V source,
+ V destination)
+Get the minimum path from the source vertex to the destination vertex.
++ If the source vertex can't reach the destination, then an exception is thrown. |
+
java.util.Collection<Edge<V,W>> |
+edges()
+Get all the edges in the graph.
++ If the graph doesn't contains edges, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+edgesOf(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that goes IN this vertex AND the edges that goes OUT of it. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getAncestors(V vertex)
+Get all the vertices that have the vertex passed as their child.
++ Basically is the opposite of getChildren(Object)+ Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getChildren(V vertex)
+Get all the vertices that are children of the vertex passed as parameter.
++ The vertices V(0-N) that are 'children' of a vertex V1, are all the vertices that have an edge + where V1 is the source of that edge. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+getEdgesIn(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as destination and another as source. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+getEdgesOut(V vertex)
+Retrieve all the edges that goes OUT of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as source and another one as destination. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getMarkedWith(java.lang.Object mark)
+Get all the vertices that are marked with the specific mark passed.
++ If there aren't vertices with that mark then it is returned an empty set. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<java.lang.Object> |
+getMarks(V vertex)
+Get all the marker of this vertex.
++ If the vertex doesn't have any mark, then it will return an empty set. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
Vertex<V> |
+getVertex(V vertex)
+Get an instance of the vertex linked with this graph.
++ For more info see Vertex |
+
W |
+getWeight(V vertex1,
+ V vertex2)
+Get the weight of the selected edge.
++ If the edge doesn't exist, then null is returned |
+
boolean |
+isCyclic()
+Tells if the graph has some cycle.
++ A cycle is detected if visiting the graph G starting from V1 (that is any of the vertex of G), + the visit can return to V1 in any point. |
+
boolean |
+isDAG()
+Tells if the graph has the property of DAG (Directed Acyclic Graph).
++ A graph is a DAG only if absent of any cycle. |
+
static <V,W extends java.lang.Number> |
+load(Graph<V,W> graph,
+ java.lang.String file,
+ java.lang.Class<V> classV,
+ java.lang.Class<W> classW)
+Load an already saved graph in an instance of a graph.
+ |
+
void |
+mark(V vertex,
+ java.lang.Object mark)
+Add to the specified vertex the mark passed.
++ A vertex can have multiple marker. |
+
java.util.Collection<java.lang.Object> |
+marks()
+Get all the marks of this graph.
++ Specifically it will return a collection of marks where every mark + as associated at least one vertex of the graph. + If the graph doesn't have vertex marked then it is returned an empty collection. |
+
int |
+numberOfEdges()
+Tells how many edges are in the graph.
+ |
+
int |
+numberOfVertices()
+Tells how many vertices are in the graph.
+ |
+
void |
+removeAllEdge()
+Remove all the edges of the graph.
++ After this method's call the graph will have only vertices, and no edge. |
+
void |
+removeAllEdge(V vertex)
+Remove all edges form a particular vertex of the graph.
++ After this method's call the selected vertex will have 0 edges. + It will be no longer possible to reach this vertex from any other vertex, and vice versa. |
+
void |
+removeAllInEdge(V vertex)
+Remove all the edges that goes in the vertex.
++ After this method's call it will be no longer possible travel to this vertex. |
+
void |
+removeAllOutEdge(V vertex)
+Remove all the edges that start from this vertex.
++ After this method's call it will be no longer possible travel to any vertex from this one. |
+
void |
+removeAllVertex()
+Remove all the vertex contained in the graph.
++ After this method's call the graph will be empty; no vertices nor edges. |
+
void |
+removeEdge(V vertex1,
+ V vertex2)
+Remove the edge between the two vertex.
++ If the edge doesn't exist, then this call does nothing. + After this method's call it will be no longer possible to travel from V1 to V2, nether from V2 to V1. |
+
void |
+removeVertex(V vertex)
+Remove the selected vertex from the graph.
++ After this method's call the vertex will be no longer present in the graph, and nether all his edges. |
+
static void |
+save(Graph<?,?> graph,
+ java.lang.String file)
+Save the Graph passed as input to a file inserted as parameter.
++ The resulting file is a Json string representing all the graph. + If the directory for getting through the file do not exist, + then it is created. + For now the marks are not included. |
+
static void |
+save(Graph<?,?> graph,
+ java.lang.String other,
+ java.lang.String file)
+Save the Graph passed as input to a file inserted as parameter.
++ The resulting file is a Json string representing all the graph. + If the directory for getting through the file do not exist, + then it is created. + For now the marks are not included. + The additional parameter is used if you want to save other as well as the graph. |
+
java.util.Collection<java.util.Collection<V>> |
+stronglyConnectedComponents()
+The strongly connected components or disconnected components of an arbitrary directed graph
+ form a partition into subgraphs that are themselves strongly connected.
+ |
+
Graph<V,W> |
+subGraph(java.lang.Object... marker)
+Get a sub-graph of the current one with only the vertex marked with the selected markers.
++ Each vertex will have all his edges, but only the ones with the destination marked with the same marker. + If the marker is not specified or is null then the returning graph will have all the vertices that are not marked by any marker. + If the graph doesn't contain any vertex with that marker then an empty graph is returned. |
+
Graph<V,W> |
+subGraph(V source,
+ int depth)
+Get a sub-graph of the current one based on the maximum depth that is given.
++ If the depth is 1 then only the source and it's children will be in the sub-graph. + If the depth is 2 then only the source, it's children and it's children of it's children will be in the sub-graph. + And so on. + Of course the sub-graph will contain the edges that link the vertices, but only the one selected. |
+
java.util.List<V> |
+topologicalSort()
+If the current graph is a DAG, it returns a topological sort of this graph.
++ A topological ordering of a graph is a linear ordering of its vertices such that for + every directed edge (V1, V2) from vertex V1 to vertex V2, V2 comes before V1 in the ordering. |
+
Graph<V,W> |
+transpose()
+This method will create a new Graph that is the transposed version of the original.
++ At the end of this method the new graph will have all the edges inverted in orientation. + Example: if the graph G contains (V1, V2, V3) as vertex, and (V1->V2, V3->V2) as edges, + the transpose graph G' will contain (V1, V2, V3) as vertex, and (V2->V1, V2->V3) as edges. |
+
void |
+unMark(V vertex)
+Unmark the vertex selected.
++ After this call the vertex will not have any marked object to himself. |
+
void |
+unMark(V vertex,
+ java.lang.Object mark)
+Remove the selected mark from the vertex.
+ |
+
void |
+unMarkAll()
+Remove all the marker to all the vertex.
++ After this call the getMarks(Object) applied to any vertex will return an empty set |
+
void |
+unMarkAll(java.lang.Object mark)
+Remove the selected mark from all the vertices
+ |
+
java.util.Collection<V> |
+vertices()
+Get all the vertices in the graph.
++ If the graph doesn't contains vertices, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
VisitInfo<V> |
+visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph accordingly to the strategy that is passed.
++ This method visit the graph from the source to all the vertex that are reachable form the source. + Some strategy can accept a source vertex null, because they visit all the graph anyway. |
+
forEach, iterator, spliteratorstatic final java.lang.String NOT_DAG+
static final java.lang.String NOT_CONNECTED+
static final java.lang.String PARAM_NULL+
static final java.lang.String VERTEX_NOT_CONTAINED+
static final com.google.gson.Gson GSON+
boolean isCyclic()+
boolean isDAG()+
isCyclic() )boolean contains(V vertex) + throws java.lang.NullPointerException+
vertex - the vertex to checkjava.lang.NullPointerException - if the vertex is nullVertex<V> getVertex(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Vertexvertex - the vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphvoid addVertex(V vertex) + throws java.lang.NullPointerException+
vertex - the vertex to addjava.lang.NullPointerException - if the vertex is nullboolean addVertexIfAbsent(V vertex) + throws java.lang.NullPointerException+
contains(Object) returns true.vertex - the vertex to addjava.lang.NullPointerException - if the vertex is nullvoid addAllVertices(java.util.Collection<V> vertices) + throws java.lang.NullPointerException+
vertices - a collection of the vertices to addjava.lang.NullPointerException - if the set is nullvoid removeVertex(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - the vertex to removejava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not containedvoid removeAllVertex()+
java.util.Collection<java.lang.Object> marks()+
void mark(V vertex, + java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - the vertex to markmark - the mark to addjava.lang.NullPointerException - if one of the param is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphvoid unMark(V vertex, + java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - the vertex where remove the markmark - the mark to removejava.lang.NullPointerException - if a param is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphvoid unMark(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - the vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphjava.util.Collection<V> getMarkedWith(java.lang.Object mark) + throws java.lang.NullPointerException+
mark - the markjava.lang.NullPointerException - if the mark is nulljava.util.Collection<java.lang.Object> getMarks(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - the vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphvoid unMarkAll(java.lang.Object mark) + throws java.lang.NullPointerException+
mark - the mark to removejava.lang.NullPointerException - if the mark is nullvoid unMarkAll()+
getMarks(Object) applied to any vertex will return an empty setW addEdge(V vertex1, + V vertex2, + W weight) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex1 - a vertex of the graphvertex2 - a vertex of the graphweight - the weight of the edgejava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphW addEdge(Edge<V,W> edge) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
edge - the edge to addjava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphW addEdgeAndVertices(V vertex1, + V vertex2, + W weight) + throws java.lang.NullPointerException+
vertex1 - a vertex of the graphvertex2 - a vertex of the graphweight - the weight of the edgejava.lang.NullPointerException - if one of the parameter is nullW addEdgeAndVertices(Edge<V,W> edge) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
edge - the edge to addjava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentExceptionvoid addAllEdges(java.util.Collection<Edge<V,W>> edges) + throws java.lang.NullPointerException+
edges - the edges to addjava.lang.NullPointerException - if the set is nullW getWeight(V vertex1, + V vertex2) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphvoid removeEdge(V vertex1, + V vertex2) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphvoid removeAllInEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphvoid removeAllOutEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphvoid removeAllEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphvoid removeAllEdge()+
boolean containsEdge(V vertex1, + V vertex2) + throws java.lang.NullPointerException+
vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.util.Collection<V> vertices()+
java.util.Collection<Edge<V,W>> edges()+
java.util.Collection<Edge<V,W>> edgesOf(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphjava.util.Collection<Edge<V,W>> getEdgesIn(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphjava.util.Collection<Edge<V,W>> getEdgesOut(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphjava.util.Collection<V> getChildren(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - the source vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphjava.util.Collection<V> getAncestors(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
getChildren(Object)vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphint degreeIn(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphint degreeOut(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphint degree(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphint numberOfVertices()+
int numberOfEdges()+
VisitInfo<V> visit(V source, + VisitStrategy<V,W> strategy, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
source - the source vertex of the visitstrategy - the algorithm for visiting the graphvisit - the function to apply at each vertexjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphGraph<V,W> transpose()+
java.util.List<V> topologicalSort() + throws java.lang.UnsupportedOperationException+
java.lang.UnsupportedOperationException - if the graph is not a DAG (see isDAG())java.util.Collection<java.util.Collection<V>> stronglyConnectedComponents()+
Graph<V,W> subGraph(V source, + int depth) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
source - the source vertexdepth - the maximum depth (must be a positive number, if >=0 a graph containing only the source is returned)java.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not containedGraph<V,W> subGraph(java.lang.Object... marker)+
marker - one or more markersjava.util.List<Edge<V,W>> distance(V source, + V destination) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException, + java.lang.UnsupportedOperationException+
source - the vertex where to startdestination - the destination chosenjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphjava.lang.UnsupportedOperationException - if from the source it's not possible to reach the destinationjava.util.Map<V,java.util.List<Edge<V,W>>> distance(V source) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
source - the vertex where to startjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphstatic void save(Graph<?,?> graph, + java.lang.String file) + throws java.io.IOException+
graph - the graph to savefile - the name of the filejava.io.IOException - for various reason that appear in the message, but the most common is that the file is not found.static void save(Graph<?,?> graph, + java.lang.String other, + java.lang.String file) + throws java.io.IOException+
graph - the graph to saveother - other things to savefile - the name of the filejava.io.IOException - for various reason that appear in the message, but the most common is that the file is not found.static <V,W extends java.lang.Number> java.lang.String load(Graph<V,W> graph, + java.lang.String file, + java.lang.Class<V> classV, + java.lang.Class<W> classW) + throws java.io.IOException, + java.lang.NullPointerException, + com.google.gson.JsonSyntaxException+
V - the parameter needed for the vertexW - the parameter needed for the weightgraph - the graph to load withfile - the file where the graph is savedclassV - the class used for the VertexclassW - the class used for the Weightjava.io.IOException - for any possible reason, the most common: the file doesn't existjava.lang.NullPointerException - if the graph is nullcom.google.gson.JsonSyntaxException - if the file is malformed or corruptedV - the vertexpublic class Vertex<V>
+extends java.lang.Object
+| Modifier and Type | +Field and Description | +
|---|---|
static java.lang.String |
+REMOVED |
+
| Constructor and Description | +
|---|
Vertex(Graph<V,?> graph,
+ V vertex)
+Get a Vertex linked with the graph
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+addChild(V child,
+ java.lang.Number weight)
+Add a child to this vertex.
++ The added child must be in the graph or it will return an exception. |
+
void |
+addIfAbsent()
+Add the vertex to the graph only if it's not already in the graph.
+ |
+
boolean |
+equals(java.lang.Object obj) |
+
java.util.Collection<V> |
+getAncestors()
+Get all the vertex ancestor of this vertex.
++ The ancestors are all the vertices that have as destination this vertex. |
+
java.util.Collection<Vertex<V>> |
+getAncestorsAsVertex()
+Get all the ancestors of this vertex like
+getAncestors(), but as Vertex.+ In this way they are linked to the graph as this one. + This method allocate a new object for each vertex, so it is more heavy. |
+
java.util.Collection<V> |
+getChildren()
+Get all the vertex children of the current vertex
+ |
+
java.util.Collection<Vertex<V>> |
+getChildrenAsVertex()
+Get all the children of this vertex like
+getChildren(), but as Vertex.+ In this way they are linked to the graph as this one. + * This method allocate a new object for each vertex, so it is more heavy. |
+
java.util.Collection<Edge<V,java.lang.Number>> |
+getEdgesIn()
+Get all the edge that goes INTO this vertex
+ |
+
java.util.Collection<Edge<V,java.lang.Number>> |
+getEdgesOut()
+Get all the edge that goes OUT of this vertex
+ |
+
java.util.Collection<java.lang.Object> |
+getMarks()
+Get all the marks that are associated with this vertex
+ |
+
V |
+getValue()
+Get the vertex
+ |
+
int |
+hashCode() |
+
boolean |
+isStillContained()
+This call tell if the current vertex is still contained in the graph linked.
++ While this function return false all the other methods will throw an exception. |
+
void |
+mark(java.lang.Object mark)
+Mark the vertex with the associated string
+ |
+
void |
+remove()
+Remove the vertex from the graph.
++ After this call all the other methods will throw an exception |
+
void |
+removeChild(V child)
+Removes a child of this vertex.
+ |
+
java.lang.String |
+toString() |
+
void |
+unMark()
+Remove all the marker from the vertex
+ |
+
void |
+unMark(java.lang.Object mark)
+Remove the specified mark from this vertex
+ |
+
VisitInfo<V> |
+visit(VisitStrategy strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph from this current vertex with the strategy assigned
+ |
+
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final java.lang.String REMOVED+
public V getValue()+
public void mark(java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.UnsupportedOperationException+
mark - the markerjava.lang.NullPointerException - if the marker is nulljava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic void unMark(java.lang.Object mark) + throws java.lang.UnsupportedOperationException+
mark - the markerjava.lang.NullPointerException - if the mark is nulljava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic void unMark() + throws java.lang.UnsupportedOperationException+
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<java.lang.Object> getMarks() + throws java.lang.UnsupportedOperationException+
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<V> getChildren() + throws java.lang.UnsupportedOperationException+
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<Vertex<V>> getChildrenAsVertex() + throws java.lang.UnsupportedOperationException+
getChildren(), but as Vertex.java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<V> getAncestors() + throws java.lang.UnsupportedOperationException+
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<Vertex<V>> getAncestorsAsVertex() + throws java.lang.UnsupportedOperationException+
getAncestors(), but as Vertex.java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<Edge<V,java.lang.Number>> getEdgesOut() + throws java.lang.UnsupportedOperationException+
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<Edge<V,java.lang.Number>> getEdgesIn() + throws java.lang.UnsupportedOperationException+
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic void addChild(V child, + java.lang.Number weight) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException, + java.lang.UnsupportedOperationException+
child - the destination vertex of this edgeweight - the weight of the edgejava.lang.NullPointerException - if the param is nulljava.lang.IllegalArgumentException - if the child vertex is not contained in the graphjava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic void removeChild(V child) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException, + java.lang.UnsupportedOperationException+
child - the child of the current vertexjava.lang.NullPointerException - if the param is nulljava.lang.IllegalArgumentException - if the child vertex is not contained in the graphjava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic boolean isStillContained()+
public void addIfAbsent()+
public void remove()+
public VisitInfo<V> visit(VisitStrategy strategy, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.UnsupportedOperationException+
strategy - the strategy of the visitvisit - the function to apply at each vertex (can be null)java.lang.NullPointerException - if the strategy is nulljava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.lang.String toString()+
toString in class java.lang.Objectpublic int hashCode()+
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)+
equals in class java.lang.Object| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.visit | ++ |
| berack96.lib.graph.visit.impl | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
java.util.Map<V,java.util.List<Edge<V,W>>> |
+Graph.distance(V source)
+Get the minimum path from the source vertex to all the possible reachable vertices.
+ |
+
java.util.List<Edge<V,W>> |
+Graph.distance(V source,
+ V destination)
+Get the minimum path from the source vertex to the destination vertex.
++ If the source vertex can't reach the destination, then an exception is thrown. |
+
java.util.Collection<Edge<V,W>> |
+Graph.edges()
+Get all the edges in the graph.
++ If the graph doesn't contains edges, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+Graph.edgesOf(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that goes IN this vertex AND the edges that goes OUT of it. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,java.lang.Number>> |
+Vertex.getEdgesIn()
+Get all the edge that goes INTO this vertex
+ |
+
java.util.Collection<Edge<V,W>> |
+Graph.getEdgesIn(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as destination and another as source. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,java.lang.Number>> |
+Vertex.getEdgesOut()
+Get all the edge that goes OUT of this vertex
+ |
+
java.util.Collection<Edge<V,W>> |
+Graph.getEdgesOut(V vertex)
+Retrieve all the edges that goes OUT of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as source and another one as destination. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
| Modifier and Type | +Method and Description | +
|---|---|
W |
+Graph.addEdge(Edge<V,W> edge)
+Add an edge between the two vertex.
++ The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+Graph.addEdgeAndVertices(Edge<V,W> edge)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices of the edge aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+Graph.addAllEdges(java.util.Collection<Edge<V,W>> edges)
+Add all the edges of the collection to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + Any null edges will be ignored. + This method will overwrite any existing edge between the two vertex. |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.Map<V,java.util.List<Edge<V,W>>> |
+MatrixGraph.distance(V source) |
+
java.util.Map<V,java.util.List<Edge<V,W>>> |
+MapGraph.distance(V source) |
+
java.util.Map<V,java.util.List<Edge<V,W>>> |
+AdjGraph.distance(V source) |
+
java.util.List<Edge<V,W>> |
+MatrixGraph.distance(V source,
+ V destination) |
+
java.util.List<Edge<V,W>> |
+MapGraph.distance(V source,
+ V destination) |
+
java.util.List<Edge<V,W>> |
+AdjGraph.distance(V source,
+ V destination) |
+
java.util.Collection<Edge<V,W>> |
+MatrixGraph.edges() |
+
java.util.Collection<Edge<V,W>> |
+MapGraph.edges() |
+
java.util.Collection<Edge<V,W>> |
+AdjGraph.edges() |
+
java.util.Collection<Edge<V,W>> |
+MatrixGraph.edgesOf(V vertex) |
+
java.util.Collection<Edge<V,W>> |
+MapGraph.edgesOf(V vertex) |
+
java.util.Collection<Edge<V,W>> |
+AdjGraph.edgesOf(V vertex) |
+
java.util.Collection<Edge<V,W>> |
+MatrixGraph.getEdgesIn(V vertex) |
+
java.util.Collection<Edge<V,W>> |
+MapGraph.getEdgesIn(V vertex) |
+
java.util.Collection<Edge<V,W>> |
+AdjGraph.getEdgesIn(V vertex) |
+
java.util.Collection<Edge<V,W>> |
+MatrixGraph.getEdgesOut(V vertex) |
+
java.util.Collection<Edge<V,W>> |
+MapGraph.getEdgesOut(V vertex) |
+
java.util.Collection<Edge<V,W>> |
+AdjGraph.getEdgesOut(V vertex) |
+
| Modifier and Type | +Method and Description | +
|---|---|
W |
+MatrixGraph.addEdge(Edge<V,W> edge) |
+
W |
+MapGraph.addEdge(Edge<V,W> edge) |
+
W |
+AdjGraph.addEdge(Edge<V,W> edge) |
+
W |
+MatrixGraph.addEdgeAndVertices(Edge<V,W> edge) |
+
W |
+MapGraph.addEdgeAndVertices(Edge<V,W> edge) |
+
W |
+AdjGraph.addEdgeAndVertices(Edge<V,W> edge) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+MatrixGraph.addAllEdges(java.util.Collection<Edge<V,W>> edges) |
+
void |
+MapGraph.addAllEdges(java.util.Collection<Edge<V,W>> edges) |
+
void |
+AdjGraph.addAllEdges(java.util.Collection<Edge<V,W>> edges) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+GraphPanel.addEdge(Edge<V,W> edge) |
+
| Modifier and Type | +Field and Description | +
|---|---|
Edge<V,W> |
+EdgeComponent.edge |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.List<Edge<V,W>> |
+VisitDistSourceDest.distance(Graph<V,W> graph,
+ V source,
+ V destination)
+Get the distance from the source to the destination
++ The list contains the minimum path from the vertex marked as source to the destination vertex |
+
java.util.Map<V,java.util.List<Edge<V,W>>> |
+VisitDistance.getLastDistance()
+Get the last calculated distance to all the possible destinations
++ The map contains all the possible vertices that are reachable from the source set in the visit + If there is no path between the destination and the source, then null is returned as accordingly to the map interface + If the visit is not already been done, then the map is null. |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.Map<V,java.util.List<Edge<V,W>>> |
+Dijkstra.getLastDistance() |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.models | ++ |
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.vertex | ++ |
| berack96.lib.graph.visit | ++ |
| berack96.lib.graph.visit.impl | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
Graph<V,W> |
+Graph.subGraph(java.lang.Object... marker)
+Get a sub-graph of the current one with only the vertex marked with the selected markers.
++ Each vertex will have all his edges, but only the ones with the destination marked with the same marker. + If the marker is not specified or is null then the returning graph will have all the vertices that are not marked by any marker. + If the graph doesn't contain any vertex with that marker then an empty graph is returned. |
+
Graph<V,W> |
+Graph.subGraph(V source,
+ int depth)
+Get a sub-graph of the current one based on the maximum depth that is given.
++ If the depth is 1 then only the source and it's children will be in the sub-graph. + If the depth is 2 then only the source, it's children and it's children of it's children will be in the sub-graph. + And so on. + Of course the sub-graph will contain the edges that link the vertices, but only the one selected. |
+
Graph<V,W> |
+Graph.transpose()
+This method will create a new Graph that is the transposed version of the original.
++ At the end of this method the new graph will have all the edges inverted in orientation. + Example: if the graph G contains (V1, V2, V3) as vertex, and (V1->V2, V3->V2) as edges, + the transpose graph G' will contain (V1, V2, V3) as vertex, and (V2->V1, V2->V3) as edges. |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <V,W extends java.lang.Number> |
+Graph.load(Graph<V,W> graph,
+ java.lang.String file,
+ java.lang.Class<V> classV,
+ java.lang.Class<W> classW)
+Load an already saved graph in an instance of a graph.
+ |
+
static void |
+Graph.save(Graph<?,?> graph,
+ java.lang.String file)
+Save the Graph passed as input to a file inserted as parameter.
++ The resulting file is a Json string representing all the graph. + If the directory for getting through the file do not exist, + then it is created. + For now the marks are not included. |
+
static void |
+Graph.save(Graph<?,?> graph,
+ java.lang.String other,
+ java.lang.String file)
+Save the Graph passed as input to a file inserted as parameter.
++ The resulting file is a Json string representing all the graph. + If the directory for getting through the file do not exist, + then it is created. + For now the marks are not included. + The additional parameter is used if you want to save other as well as the graph. |
+
| Constructor and Description | +
|---|
Vertex(Graph<V,?> graph,
+ V vertex)
+Get a Vertex linked with the graph
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+AdjGraph<V,W extends java.lang.Number> |
+
class |
+MapGraph<V,W extends java.lang.Number>
+Graph that uses HashMap for vertices and edges
++ More specifically it utilizes a Map containing all the vertices mapped to all their edges + Technically this version of the graph combine the fast adding/removing of the edges of the Matrix implementation, + with the low memory and fast adding/removing of vertices of the Linked List implementation. + This happen if the HashMap is not reallocated. |
+
class |
+MatrixGraph<V,W extends java.lang.Number> |
+
| Modifier and Type | +Method and Description | +
|---|---|
Graph<V,W> |
+MatrixGraph.subGraph(java.lang.Object... marker) |
+
Graph<V,W> |
+MapGraph.subGraph(java.lang.Object... marker) |
+
Graph<V,W> |
+AdjGraph.subGraph(java.lang.Object... marker) |
+
Graph<V,W> |
+MatrixGraph.subGraph(V source,
+ int depth) |
+
Graph<V,W> |
+MapGraph.subGraph(V source,
+ int depth) |
+
Graph<V,W> |
+AdjGraph.subGraph(V source,
+ int depth) |
+
Graph<V,W> |
+MatrixGraph.transpose() |
+
Graph<V,W> |
+MapGraph.transpose() |
+
Graph<V,W> |
+AdjGraph.transpose() |
+
| Constructor and Description | +
|---|
GraphSaveStructure(Graph<?,?> graph,
+ java.lang.String other) |
+
| Modifier and Type | +Method and Description | +
|---|---|
Graph<V,W> |
+GraphPanel.getGraph() |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.Integer |
+VertexIntListener.buildNewVertex(Graph<java.lang.Integer,?> graph) |
+
protected abstract V |
+VertexListener.buildNewVertex(Graph<V,?> graph) |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.List<Edge<V,W>> |
+VisitDistSourceDest.distance(Graph<V,W> graph,
+ V source,
+ V destination)
+Get the distance from the source to the destination
++ The list contains the minimum path from the vertex marked as source to the destination vertex |
+
VisitInfo<V> |
+VisitStrategy.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+With this the graph will be visited accordingly to the strategy of the visit.
++ Some strategy can accept a source vertex null, because they visit all the graph anyway. + If you want to stop the visit of the graph, you just have to throw any exception in the visit function, but be sure to catch it |
+
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+Tarjan.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+This particular visit strategy use only the graph and the visit, so the source param is not needed.
+ |
+
VisitInfo<V> |
+Dijkstra.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit) |
+
VisitInfo<V> |
+DFS.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit) |
+
VisitInfo<V> |
+BFS.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit) |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.vertex | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
Vertex<V> |
+Graph.getVertex(V vertex)
+Get an instance of the vertex linked with this graph.
++ For more info see Vertex |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.Collection<Vertex<V>> |
+Vertex.getAncestorsAsVertex()
+Get all the ancestors of this vertex like
+getAncestors(), but as Vertex.+ In this way they are linked to the graph as this one. + This method allocate a new object for each vertex, so it is more heavy. |
+
java.util.Collection<Vertex<V>> |
+Vertex.getChildrenAsVertex()
+Get all the children of this vertex like
+getChildren(), but as Vertex.+ In this way they are linked to the graph as this one. + * This method allocate a new object for each vertex, so it is more heavy. |
+
| Modifier and Type | +Method and Description | +
|---|---|
Vertex<V> |
+MatrixGraph.getVertex(V vertex) |
+
Vertex<V> |
+MapGraph.getVertex(V vertex) |
+
Vertex<V> |
+AdjGraph.getVertex(V vertex) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected abstract W |
+EdgeListener.buildNewEdge(Vertex<V> vertex,
+ Vertex<V> vertex1) |
+
protected abstract W |
+EdgeListener.buildNewEdge(Vertex<V> vertex,
+ Vertex<V> vertex1) |
+
protected java.lang.Integer |
+EdgeIntListener.buildNewEdge(Vertex<V> vertex,
+ Vertex<V> vertex1) |
+
protected java.lang.Integer |
+EdgeIntListener.buildNewEdge(Vertex<V> vertex,
+ Vertex<V> vertex1) |
+
| Modifier and Type | +Field and Description | +
|---|---|
Vertex<V> |
+VertexComponent.vertex |
+
| Constructor and Description | +
|---|
VertexComponent(Vertex<V> vertex) |
+
GSON, NOT_CONNECTED, NOT_DAG, PARAM_NULL, VERTEX_NOT_CONTAINED| Modifier and Type | +Method and Description | +
|---|---|
void |
+addAllEdges(java.util.Collection<Edge<V,W>> edges)
+Add all the edges of the collection to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + Any null edges will be ignored. + This method will overwrite any existing edge between the two vertex. |
+
void |
+addAllVertices(java.util.Collection<V> vertices)
+Add all the vertices contained in the collection to the graph.
++ If a vertex is contained in the collection and in the graph is ignored and it will not be replaced. + Null vertices will be ignored and they will not be added to the graph. |
+
W |
+addEdge(Edge<V,W> edge)
+Add an edge between the two vertex.
++ The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdge(V vertex1,
+ V vertex2,
+ W weight)
+Add an edge between the two vertex.
++ The edge will be created from the vertex V1 and the vertex V2 + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdgeAndVertices(Edge<V,W> edge)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices of the edge aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdgeAndVertices(V vertex1,
+ V vertex2,
+ W weight)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex V1 and the vertex V2 + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
void |
+addVertex(V vertex)
+Add the vertex to the graph.
+ |
+
boolean |
+addVertexIfAbsent(V vertex)
+Add the specified vertex to the graph only if the graph doesn't contains it.
++ The graph contains a vertex only if the method Graph.contains(Object) returns true. |
+
boolean |
+contains(V vertex)
+Check if the vertex passed is contained in the graph or not.
++ The vertex V1 is contained in the graph G, if and only if: + exist V2 in G such that V2.equals(V1) |
+
boolean |
+containsEdge(V vertex1,
+ V vertex2)
+Check if the edge between the two vertex passed is contained in the graph or not.
++ An edge between V1 and V2 is contained in the graph if and only if i can travel from V1 to V2. + If one of the two vertices is not contained in the graph, then even the edge isn't |
+
int |
+degree(V vertex)
+Tells the degree of a vertex.
++ The degree of a vertex is the quantity of edges that have. + Basically, it'll count how many edge it have. |
+
int |
+degreeIn(V vertex)
+Tells the degree of all the edges that goes to this vertex.
++ Basically, it'll count how many edge towards himself it have. |
+
int |
+degreeOut(V vertex)
+Tells the degree of all the edges that goes form this vertex to others.
++ Basically, it'll count how many edge towards any other vertex it have. |
+
java.util.Map<V,java.util.List<Edge<V,W>>> |
+distance(V source)
+Get the minimum path from the source vertex to all the possible reachable vertices.
+ |
+
java.util.List<Edge<V,W>> |
+distance(V source,
+ V destination)
+Get the minimum path from the source vertex to the destination vertex.
++ If the source vertex can't reach the destination, then an exception is thrown. |
+
java.util.Collection<Edge<V,W>> |
+edges()
+Get all the edges in the graph.
++ If the graph doesn't contains edges, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+edgesOf(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that goes IN this vertex AND the edges that goes OUT of it. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getAncestors(V vertex)
+Get all the vertices that have the vertex passed as their child.
++ Basically is the opposite of Graph.getChildren(Object)+ Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getChildren(V vertex)
+Get all the vertices that are children of the vertex passed as parameter.
++ The vertices V(0-N) that are 'children' of a vertex V1, are all the vertices that have an edge + where V1 is the source of that edge. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+getEdgesIn(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as destination and another as source. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+getEdgesOut(V vertex)
+Retrieve all the edges that goes OUT of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as source and another one as destination. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getMarkedWith(java.lang.Object mark)
+Get all the vertices that are marked with the specific mark passed.
++ If there aren't vertices with that mark then it is returned an empty set. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<java.lang.Object> |
+getMarks(V vertex)
+Get all the marker of this vertex.
++ If the vertex doesn't have any mark, then it will return an empty set. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
Vertex<V> |
+getVertex(V vertex)
+Get an instance of the vertex linked with this graph.
++ For more info see Vertex |
+
W |
+getWeight(V vertex1,
+ V vertex2)
+Get the weight of the selected edge.
++ If the edge doesn't exist, then null is returned |
+
boolean |
+isCyclic()
+Tells if the graph has some cycle.
++ A cycle is detected if visiting the graph G starting from V1 (that is any of the vertex of G), + the visit can return to V1 in any point. |
+
boolean |
+isDAG()
+Tells if the graph has the property of DAG (Directed Acyclic Graph).
++ A graph is a DAG only if absent of any cycle. |
+
java.util.Iterator<V> |
+iterator() |
+
void |
+mark(V vertex,
+ java.lang.Object mark)
+Add to the specified vertex the mark passed.
++ A vertex can have multiple marker. |
+
java.util.Collection<java.lang.Object> |
+marks()
+Get all the marks of this graph.
++ Specifically it will return a collection of marks where every mark + as associated at least one vertex of the graph. + If the graph doesn't have vertex marked then it is returned an empty collection. |
+
int |
+numberOfEdges()
+Tells how many edges are in the graph.
+ |
+
int |
+numberOfVertices()
+Tells how many vertices are in the graph.
+ |
+
void |
+removeAllEdge()
+Remove all the edges of the graph.
++ After this method's call the graph will have only vertices, and no edge. |
+
void |
+removeAllEdge(V vertex)
+Remove all edges form a particular vertex of the graph.
++ After this method's call the selected vertex will have 0 edges. + It will be no longer possible to reach this vertex from any other vertex, and vice versa. |
+
void |
+removeAllInEdge(V vertex)
+Remove all the edges that goes in the vertex.
++ After this method's call it will be no longer possible travel to this vertex. |
+
void |
+removeAllOutEdge(V vertex)
+Remove all the edges that start from this vertex.
++ After this method's call it will be no longer possible travel to any vertex from this one. |
+
void |
+removeAllVertex()
+Remove all the vertex contained in the graph.
++ After this method's call the graph will be empty; no vertices nor edges. |
+
void |
+removeEdge(V vertex1,
+ V vertex2)
+Remove the edge between the two vertex.
++ If the edge doesn't exist, then this call does nothing. + After this method's call it will be no longer possible to travel from V1 to V2, nether from V2 to V1. |
+
void |
+removeVertex(V vertex)
+Remove the selected vertex from the graph.
++ After this method's call the vertex will be no longer present in the graph, and nether all his edges. |
+
java.util.Collection<java.util.Collection<V>> |
+stronglyConnectedComponents()
+The strongly connected components or disconnected components of an arbitrary directed graph
+ form a partition into subgraphs that are themselves strongly connected.
+ |
+
Graph<V,W> |
+subGraph(java.lang.Object... marker)
+Get a sub-graph of the current one with only the vertex marked with the selected markers.
++ Each vertex will have all his edges, but only the ones with the destination marked with the same marker. + If the marker is not specified or is null then the returning graph will have all the vertices that are not marked by any marker. + If the graph doesn't contain any vertex with that marker then an empty graph is returned. |
+
Graph<V,W> |
+subGraph(V source,
+ int depth)
+Get a sub-graph of the current one based on the maximum depth that is given.
++ If the depth is 1 then only the source and it's children will be in the sub-graph. + If the depth is 2 then only the source, it's children and it's children of it's children will be in the sub-graph. + And so on. + Of course the sub-graph will contain the edges that link the vertices, but only the one selected. |
+
java.util.List<V> |
+topologicalSort()
+If the current graph is a DAG, it returns a topological sort of this graph.
++ A topological ordering of a graph is a linear ordering of its vertices such that for + every directed edge (V1, V2) from vertex V1 to vertex V2, V2 comes before V1 in the ordering. |
+
Graph<V,W> |
+transpose()
+This method will create a new Graph that is the transposed version of the original.
++ At the end of this method the new graph will have all the edges inverted in orientation. + Example: if the graph G contains (V1, V2, V3) as vertex, and (V1->V2, V3->V2) as edges, + the transpose graph G' will contain (V1, V2, V3) as vertex, and (V2->V1, V2->V3) as edges. |
+
void |
+unMark(V vertex)
+Unmark the vertex selected.
++ After this call the vertex will not have any marked object to himself. |
+
void |
+unMark(V vertex,
+ java.lang.Object mark)
+Remove the selected mark from the vertex.
+ |
+
void |
+unMarkAll()
+Remove all the marker to all the vertex.
++ After this call the Graph.getMarks(Object) applied to any vertex will return an empty set |
+
void |
+unMarkAll(java.lang.Object mark)
+Remove the selected mark from all the vertices
+ |
+
java.util.Collection<V> |
+vertices()
+Get all the vertices in the graph.
++ If the graph doesn't contains vertices, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
VisitInfo<V> |
+visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph accordingly to the strategy that is passed.
++ This method visit the graph from the source to all the vertex that are reachable form the source. + Some strategy can accept a source vertex null, because they visit all the graph anyway. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic java.util.Iterator<V> iterator()+
iterator in interface java.lang.Iterable<V>public boolean isCyclic()+
Graphpublic boolean isDAG()+
GraphGraph.isCyclic() )public Vertex<V> getVertex(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphVertexpublic void addVertex(V vertex) + throws java.lang.NullPointerException+
Graphpublic boolean addVertexIfAbsent(V vertex) + throws java.lang.NullPointerException+
GraphGraph.contains(Object) returns true.addVertexIfAbsent in interface Graph<V,W extends java.lang.Number>vertex - the vertex to addjava.lang.NullPointerException - if the vertex is nullpublic void addAllVertices(java.util.Collection<V> vertices) + throws java.lang.NullPointerException+
GraphaddAllVertices in interface Graph<V,W extends java.lang.Number>vertices - a collection of the vertices to addjava.lang.NullPointerException - if the set is nullpublic void removeVertex(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveVertex in interface Graph<V,W extends java.lang.Number>vertex - the vertex to removejava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not containedpublic void removeAllVertex()+
GraphremoveAllVertex in interface Graph<V,W extends java.lang.Number>public boolean contains(V vertex) + throws java.lang.NullPointerException+
Graphpublic java.util.Collection<java.lang.Object> marks()+
Graphpublic void mark(V vertex, + java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic void unMark(V vertex, + java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphunMark in interface Graph<V,W extends java.lang.Number>vertex - the vertex where remove the markmark - the mark to removejava.lang.NullPointerException - if a param is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic void unMark(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic java.util.Collection<V> getMarkedWith(java.lang.Object mark) + throws java.lang.NullPointerException+
GraphgetMarkedWith in interface Graph<V,W extends java.lang.Number>mark - the markjava.lang.NullPointerException - if the mark is nullpublic java.util.Collection<java.lang.Object> getMarks(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetMarks in interface Graph<V,W extends java.lang.Number>vertex - the vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic void unMarkAll(java.lang.Object mark) + throws java.lang.NullPointerException+
Graphpublic void unMarkAll()+
GraphGraph.getMarks(Object) applied to any vertex will return an empty setpublic W addEdge(V vertex1, + V vertex2, + W weight) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphweight - the weight of the edgejava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic W addEdge(Edge<V,W> edge) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdge in interface Graph<V,W extends java.lang.Number>edge - the edge to addjava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic W addEdgeAndVertices(V vertex1, + V vertex2, + W weight) + throws java.lang.NullPointerException+
GraphaddEdgeAndVertices in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphweight - the weight of the edgejava.lang.NullPointerException - if one of the parameter is nullpublic W addEdgeAndVertices(Edge<V,W> edge) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdgeAndVertices in interface Graph<V,W extends java.lang.Number>edge - the edge to addjava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentExceptionpublic void addAllEdges(java.util.Collection<Edge<V,W>> edges) + throws java.lang.NullPointerException+
GraphaddAllEdges in interface Graph<V,W extends java.lang.Number>edges - the edges to addjava.lang.NullPointerException - if the set is nullpublic W getWeight(V vertex1, + V vertex2) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetWeight in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeEdge(V vertex1, + V vertex2) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllInEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllInEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllOutEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllOutEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllEdge()+
GraphremoveAllEdge in interface Graph<V,W extends java.lang.Number>public boolean containsEdge(V vertex1, + V vertex2) + throws java.lang.NullPointerException+
GraphcontainsEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nullpublic java.util.Collection<V> vertices()+
Graphpublic java.util.Collection<Edge<V,W>> edges()+
Graphpublic java.util.Collection<Edge<V,W>> edgesOf(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic java.util.Collection<Edge<V,W>> getEdgesIn(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetEdgesIn in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<Edge<V,W>> getEdgesOut(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetEdgesOut in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<V> getChildren(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetChildren in interface Graph<V,W extends java.lang.Number>vertex - the source vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<V> getAncestors(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphGraph.getChildren(Object)getAncestors in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic int degreeIn(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphdegreeIn in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int degreeOut(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphdegreeOut in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int degree(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphdegree in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int numberOfVertices()+
GraphnumberOfVertices in interface Graph<V,W extends java.lang.Number>public int numberOfEdges()+
GraphnumberOfEdges in interface Graph<V,W extends java.lang.Number>public VisitInfo<V> visit(V source, + VisitStrategy<V,W> strategy, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphvisit in interface Graph<V,W extends java.lang.Number>source - the source vertex of the visitstrategy - the algorithm for visiting the graphvisit - the function to apply at each vertexjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphpublic Graph<V,W> transpose()+
Graphpublic java.util.List<V> topologicalSort() + throws java.lang.UnsupportedOperationException+
GraphtopologicalSort in interface Graph<V,W extends java.lang.Number>java.lang.UnsupportedOperationException - if the graph is not a DAG (see Graph.isDAG())public java.util.Collection<java.util.Collection<V>> stronglyConnectedComponents()+
GraphstronglyConnectedComponents in interface Graph<V,W extends java.lang.Number>public Graph<V,W> subGraph(V source, + int depth) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphsubGraph in interface Graph<V,W extends java.lang.Number>source - the source vertexdepth - the maximum depth (must be a positive number, if >=0 a graph containing only the source is returned)java.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not containedpublic Graph<V,W> subGraph(java.lang.Object... marker)+
Graphpublic java.util.List<Edge<V,W>> distance(V source, + V destination) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException, + java.lang.UnsupportedOperationException+
Graphdistance in interface Graph<V,W extends java.lang.Number>source - the vertex where to startdestination - the destination chosenjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphjava.lang.UnsupportedOperationException - if from the source it's not possible to reach the destinationpublic java.util.Map<V,java.util.List<Edge<V,W>>> distance(V source) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphdistance in interface Graph<V,W extends java.lang.Number>source - the vertex where to startjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphV - the verticesW - the weight of the edgespublic class MapGraph<V,W extends java.lang.Number> +extends java.lang.Object +implements Graph<V,W>+
GSON, NOT_CONNECTED, NOT_DAG, PARAM_NULL, VERTEX_NOT_CONTAINED| Modifier and Type | +Method and Description | +
|---|---|
void |
+addAllEdges(java.util.Collection<Edge<V,W>> edges)
+Add all the edges of the collection to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + Any null edges will be ignored. + This method will overwrite any existing edge between the two vertex. |
+
void |
+addAllVertices(java.util.Collection<V> vertices)
+Add all the vertices contained in the collection to the graph.
++ If a vertex is contained in the collection and in the graph is ignored and it will not be replaced. + Null vertices will be ignored and they will not be added to the graph. |
+
W |
+addEdge(Edge<V,W> edge)
+Add an edge between the two vertex.
++ The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdge(V vertex1,
+ V vertex2,
+ W weight)
+Add an edge between the two vertex.
++ The edge will be created from the vertex V1 and the vertex V2 + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdgeAndVertices(Edge<V,W> edge)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices of the edge aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdgeAndVertices(V vertex1,
+ V vertex2,
+ W weight)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex V1 and the vertex V2 + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
void |
+addVertex(V vertex)
+Add the vertex to the graph.
+ |
+
boolean |
+addVertexIfAbsent(V vertex)
+Add the specified vertex to the graph only if the graph doesn't contains it.
++ The graph contains a vertex only if the method Graph.contains(Object) returns true. |
+
boolean |
+contains(V vertex)
+Check if the vertex passed is contained in the graph or not.
++ The vertex V1 is contained in the graph G, if and only if: + exist V2 in G such that V2.equals(V1) |
+
boolean |
+containsEdge(V vertex1,
+ V vertex2)
+Check if the edge between the two vertex passed is contained in the graph or not.
++ An edge between V1 and V2 is contained in the graph if and only if i can travel from V1 to V2. + If one of the two vertices is not contained in the graph, then even the edge isn't |
+
int |
+degree(V vertex)
+Tells the degree of a vertex.
++ The degree of a vertex is the quantity of edges that have. + Basically, it'll count how many edge it have. |
+
int |
+degreeIn(V vertex)
+Tells the degree of all the edges that goes to this vertex.
++ Basically, it'll count how many edge towards himself it have. |
+
int |
+degreeOut(V vertex)
+Tells the degree of all the edges that goes form this vertex to others.
++ Basically, it'll count how many edge towards any other vertex it have. |
+
java.util.Map<V,java.util.List<Edge<V,W>>> |
+distance(V source)
+Get the minimum path from the source vertex to all the possible reachable vertices.
+ |
+
java.util.List<Edge<V,W>> |
+distance(V source,
+ V destination)
+Get the minimum path from the source vertex to the destination vertex.
++ If the source vertex can't reach the destination, then an exception is thrown. |
+
java.util.Collection<Edge<V,W>> |
+edges()
+Get all the edges in the graph.
++ If the graph doesn't contains edges, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+edgesOf(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that goes IN this vertex AND the edges that goes OUT of it. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getAncestors(V vertex)
+Get all the vertices that have the vertex passed as their child.
++ Basically is the opposite of Graph.getChildren(Object)+ Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getChildren(V vertex)
+Get all the vertices that are children of the vertex passed as parameter.
++ The vertices V(0-N) that are 'children' of a vertex V1, are all the vertices that have an edge + where V1 is the source of that edge. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+getEdgesIn(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as destination and another as source. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+getEdgesOut(V vertex)
+Retrieve all the edges that goes OUT of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as source and another one as destination. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getMarkedWith(java.lang.Object mark)
+Get all the vertices that are marked with the specific mark passed.
++ If there aren't vertices with that mark then it is returned an empty set. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<java.lang.Object> |
+getMarks(V vertex)
+Get all the marker of this vertex.
++ If the vertex doesn't have any mark, then it will return an empty set. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
Vertex<V> |
+getVertex(V vertex)
+Get an instance of the vertex linked with this graph.
++ For more info see Vertex |
+
W |
+getWeight(V vertex1,
+ V vertex2)
+Get the weight of the selected edge.
++ If the edge doesn't exist, then null is returned |
+
boolean |
+isCyclic()
+Tells if the graph has some cycle.
++ A cycle is detected if visiting the graph G starting from V1 (that is any of the vertex of G), + the visit can return to V1 in any point. |
+
boolean |
+isDAG()
+Tells if the graph has the property of DAG (Directed Acyclic Graph).
++ A graph is a DAG only if absent of any cycle. |
+
java.util.Iterator<V> |
+iterator() |
+
void |
+mark(V vertex,
+ java.lang.Object mark)
+Add to the specified vertex the mark passed.
++ A vertex can have multiple marker. |
+
java.util.Collection<java.lang.Object> |
+marks()
+Get all the marks of this graph.
++ Specifically it will return a collection of marks where every mark + as associated at least one vertex of the graph. + If the graph doesn't have vertex marked then it is returned an empty collection. |
+
int |
+numberOfEdges()
+Tells how many edges are in the graph.
+ |
+
int |
+numberOfVertices()
+Tells how many vertices are in the graph.
+ |
+
void |
+removeAllEdge()
+Remove all the edges of the graph.
++ After this method's call the graph will have only vertices, and no edge. |
+
void |
+removeAllEdge(V vertex)
+Remove all edges form a particular vertex of the graph.
++ After this method's call the selected vertex will have 0 edges. + It will be no longer possible to reach this vertex from any other vertex, and vice versa. |
+
void |
+removeAllInEdge(V vertex)
+Remove all the edges that goes in the vertex.
++ After this method's call it will be no longer possible travel to this vertex. |
+
void |
+removeAllOutEdge(V vertex)
+Remove all the edges that start from this vertex.
++ After this method's call it will be no longer possible travel to any vertex from this one. |
+
void |
+removeAllVertex()
+Remove all the vertex contained in the graph.
++ After this method's call the graph will be empty; no vertices nor edges. |
+
void |
+removeEdge(V vertex1,
+ V vertex2)
+Remove the edge between the two vertex.
++ If the edge doesn't exist, then this call does nothing. + After this method's call it will be no longer possible to travel from V1 to V2, nether from V2 to V1. |
+
void |
+removeVertex(V vertex)
+Remove the selected vertex from the graph.
++ After this method's call the vertex will be no longer present in the graph, and nether all his edges. |
+
java.util.Collection<java.util.Collection<V>> |
+stronglyConnectedComponents()
+The strongly connected components or disconnected components of an arbitrary directed graph
+ form a partition into subgraphs that are themselves strongly connected.
+ |
+
Graph<V,W> |
+subGraph(java.lang.Object... marker)
+Get a sub-graph of the current one with only the vertex marked with the selected markers.
++ Each vertex will have all his edges, but only the ones with the destination marked with the same marker. + If the marker is not specified or is null then the returning graph will have all the vertices that are not marked by any marker. + If the graph doesn't contain any vertex with that marker then an empty graph is returned. |
+
Graph<V,W> |
+subGraph(V source,
+ int depth)
+Get a sub-graph of the current one based on the maximum depth that is given.
++ If the depth is 1 then only the source and it's children will be in the sub-graph. + If the depth is 2 then only the source, it's children and it's children of it's children will be in the sub-graph. + And so on. + Of course the sub-graph will contain the edges that link the vertices, but only the one selected. |
+
java.util.List<V> |
+topologicalSort()
+If the current graph is a DAG, it returns a topological sort of this graph.
++ A topological ordering of a graph is a linear ordering of its vertices such that for + every directed edge (V1, V2) from vertex V1 to vertex V2, V2 comes before V1 in the ordering. |
+
Graph<V,W> |
+transpose()
+This method will create a new Graph that is the transposed version of the original.
++ At the end of this method the new graph will have all the edges inverted in orientation. + Example: if the graph G contains (V1, V2, V3) as vertex, and (V1->V2, V3->V2) as edges, + the transpose graph G' will contain (V1, V2, V3) as vertex, and (V2->V1, V2->V3) as edges. |
+
void |
+unMark(V vertex)
+Unmark the vertex selected.
++ After this call the vertex will not have any marked object to himself. |
+
void |
+unMark(V vertex,
+ java.lang.Object mark)
+Remove the selected mark from the vertex.
+ |
+
void |
+unMarkAll()
+Remove all the marker to all the vertex.
++ After this call the Graph.getMarks(Object) applied to any vertex will return an empty set |
+
void |
+unMarkAll(java.lang.Object mark)
+Remove the selected mark from all the vertices
+ |
+
java.util.Collection<V> |
+vertices()
+Get all the vertices in the graph.
++ If the graph doesn't contains vertices, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
VisitInfo<V> |
+visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph accordingly to the strategy that is passed.
++ This method visit the graph from the source to all the vertex that are reachable form the source. + Some strategy can accept a source vertex null, because they visit all the graph anyway. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic boolean isCyclic()+
Graphpublic boolean isDAG()+
GraphGraph.isCyclic() )public Vertex<V> getVertex(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphVertexpublic void addVertex(V vertex) + throws java.lang.NullPointerException+
Graphpublic boolean addVertexIfAbsent(V vertex) + throws java.lang.NullPointerException+
GraphGraph.contains(Object) returns true.addVertexIfAbsent in interface Graph<V,W extends java.lang.Number>vertex - the vertex to addjava.lang.NullPointerException - if the vertex is nullpublic void addAllVertices(java.util.Collection<V> vertices) + throws java.lang.NullPointerException+
GraphaddAllVertices in interface Graph<V,W extends java.lang.Number>vertices - a collection of the vertices to addjava.lang.NullPointerException - if the set is nullpublic void removeVertex(V vertex) + throws java.lang.NullPointerException+
GraphremoveVertex in interface Graph<V,W extends java.lang.Number>vertex - the vertex to removejava.lang.NullPointerException - if the vertex is nullpublic void removeAllVertex()+
GraphremoveAllVertex in interface Graph<V,W extends java.lang.Number>public boolean contains(V vertex) + throws java.lang.NullPointerException+
Graphpublic java.util.Collection<java.lang.Object> marks()+
Graphpublic void mark(V vertex, + java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic void unMark(V vertex, + java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphunMark in interface Graph<V,W extends java.lang.Number>vertex - the vertex where remove the markmark - the mark to removejava.lang.NullPointerException - if a param is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic void unMark(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic java.util.Collection<V> getMarkedWith(java.lang.Object mark) + throws java.lang.NullPointerException+
GraphgetMarkedWith in interface Graph<V,W extends java.lang.Number>mark - the markjava.lang.NullPointerException - if the mark is nullpublic java.util.Collection<java.lang.Object> getMarks(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetMarks in interface Graph<V,W extends java.lang.Number>vertex - the vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic void unMarkAll(java.lang.Object mark)+
Graphpublic void unMarkAll()+
GraphGraph.getMarks(Object) applied to any vertex will return an empty setpublic W addEdge(V vertex1, + V vertex2, + W weight) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphweight - the weight of the edgejava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic W addEdge(Edge<V,W> edge) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdge in interface Graph<V,W extends java.lang.Number>edge - the edge to addjava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic W addEdgeAndVertices(V vertex1, + V vertex2, + W weight) + throws java.lang.NullPointerException+
GraphaddEdgeAndVertices in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphweight - the weight of the edgejava.lang.NullPointerException - if one of the parameter is nullpublic W addEdgeAndVertices(Edge<V,W> edge) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdgeAndVertices in interface Graph<V,W extends java.lang.Number>edge - the edge to addjava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentExceptionpublic void addAllEdges(java.util.Collection<Edge<V,W>> edges) + throws java.lang.NullPointerException+
GraphaddAllEdges in interface Graph<V,W extends java.lang.Number>edges - the edges to addjava.lang.NullPointerException - if the set is nullpublic W getWeight(V vertex1, + V vertex2) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetWeight in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeEdge(V vertex1, + V vertex2) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllInEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllInEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllOutEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllOutEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllEdge()+
GraphremoveAllEdge in interface Graph<V,W extends java.lang.Number>public boolean containsEdge(V vertex1, + V vertex2) + throws java.lang.NullPointerException+
GraphcontainsEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nullpublic java.util.Collection<V> vertices()+
Graphpublic java.util.Collection<Edge<V,W>> edges()+
Graphpublic java.util.Collection<Edge<V,W>> edgesOf(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic java.util.Collection<Edge<V,W>> getEdgesIn(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetEdgesIn in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<Edge<V,W>> getEdgesOut(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetEdgesOut in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<V> getChildren(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetChildren in interface Graph<V,W extends java.lang.Number>vertex - the source vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<V> getAncestors(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphGraph.getChildren(Object)getAncestors in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic int degreeIn(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphdegreeIn in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int degreeOut(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphdegreeOut in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int degree(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphdegree in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int numberOfVertices()+
GraphnumberOfVertices in interface Graph<V,W extends java.lang.Number>public int numberOfEdges()+
GraphnumberOfEdges in interface Graph<V,W extends java.lang.Number>public VisitInfo<V> visit(V source, + VisitStrategy<V,W> strategy, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphvisit in interface Graph<V,W extends java.lang.Number>source - the source vertex of the visitstrategy - the algorithm for visiting the graphvisit - the function to apply at each vertexjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphpublic Graph<V,W> transpose()+
Graphpublic java.util.List<V> topologicalSort() + throws java.lang.UnsupportedOperationException+
GraphtopologicalSort in interface Graph<V,W extends java.lang.Number>java.lang.UnsupportedOperationException - if the graph is not a DAG (see Graph.isDAG())public java.util.Collection<java.util.Collection<V>> stronglyConnectedComponents()+
GraphstronglyConnectedComponents in interface Graph<V,W extends java.lang.Number>public Graph<V,W> subGraph(V source, + int depth) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphsubGraph in interface Graph<V,W extends java.lang.Number>source - the source vertexdepth - the maximum depth (must be a positive number, if >=0 a graph containing only the source is returned)java.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not containedpublic Graph<V,W> subGraph(java.lang.Object... marker)+
Graphpublic java.util.List<Edge<V,W>> distance(V source, + V destination) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException, + java.lang.UnsupportedOperationException+
Graphdistance in interface Graph<V,W extends java.lang.Number>source - the vertex where to startdestination - the destination chosenjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphjava.lang.UnsupportedOperationException - if from the source it's not possible to reach the destinationpublic java.util.Map<V,java.util.List<Edge<V,W>>> distance(V source) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphdistance in interface Graph<V,W extends java.lang.Number>source - the vertex where to startjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphGSON, NOT_CONNECTED, NOT_DAG, PARAM_NULL, VERTEX_NOT_CONTAINED| Constructor and Description | +
|---|
MatrixGraph() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+addAllEdges(java.util.Collection<Edge<V,W>> edges)
+Add all the edges of the collection to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + Any null edges will be ignored. + This method will overwrite any existing edge between the two vertex. |
+
void |
+addAllVertices(java.util.Collection<V> vertices)
+Add all the vertices contained in the collection to the graph.
++ If a vertex is contained in the collection and in the graph is ignored and it will not be replaced. + Null vertices will be ignored and they will not be added to the graph. |
+
W |
+addEdge(Edge<V,W> edge)
+Add an edge between the two vertex.
++ The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdge(V vertex1,
+ V vertex2,
+ W weight)
+Add an edge between the two vertex.
++ The edge will be created from the vertex V1 and the vertex V2 + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdgeAndVertices(Edge<V,W> edge)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices of the edge aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex source of the edge and the vertex destination of it + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
W |
+addEdgeAndVertices(V vertex1,
+ V vertex2,
+ W weight)
+This particular function add an edge to the graph.
++ If one of the two, or both vertices aren't contained in the graph, then the vertices will be added. + The edge will be created from the vertex V1 and the vertex V2 + This method will overwrite any existing edge between the two vertex. + If there was a previous edge then it is returned |
+
void |
+addVertex(V vertex)
+Add the vertex to the graph.
+ |
+
boolean |
+addVertexIfAbsent(V vertex)
+Add the specified vertex to the graph only if the graph doesn't contains it.
++ The graph contains a vertex only if the method Graph.contains(Object) returns true. |
+
boolean |
+contains(V vertex)
+Check if the vertex passed is contained in the graph or not.
++ The vertex V1 is contained in the graph G, if and only if: + exist V2 in G such that V2.equals(V1) |
+
boolean |
+containsEdge(V vertex1,
+ V vertex2)
+Check if the edge between the two vertex passed is contained in the graph or not.
++ An edge between V1 and V2 is contained in the graph if and only if i can travel from V1 to V2. + If one of the two vertices is not contained in the graph, then even the edge isn't |
+
int |
+degree(V vertex)
+Tells the degree of a vertex.
++ The degree of a vertex is the quantity of edges that have. + Basically, it'll count how many edge it have. |
+
int |
+degreeIn(V vertex)
+Tells the degree of all the edges that goes to this vertex.
++ Basically, it'll count how many edge towards himself it have. |
+
int |
+degreeOut(V vertex)
+Tells the degree of all the edges that goes form this vertex to others.
++ Basically, it'll count how many edge towards any other vertex it have. |
+
java.util.Map<V,java.util.List<Edge<V,W>>> |
+distance(V source)
+Get the minimum path from the source vertex to all the possible reachable vertices.
+ |
+
java.util.List<Edge<V,W>> |
+distance(V source,
+ V destination)
+Get the minimum path from the source vertex to the destination vertex.
++ If the source vertex can't reach the destination, then an exception is thrown. |
+
java.util.Collection<Edge<V,W>> |
+edges()
+Get all the edges in the graph.
++ If the graph doesn't contains edges, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+edgesOf(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that goes IN this vertex AND the edges that goes OUT of it. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getAncestors(V vertex)
+Get all the vertices that have the vertex passed as their child.
++ Basically is the opposite of Graph.getChildren(Object)+ Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getChildren(V vertex)
+Get all the vertices that are children of the vertex passed as parameter.
++ The vertices V(0-N) that are 'children' of a vertex V1, are all the vertices that have an edge + where V1 is the source of that edge. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+getEdgesIn(V vertex)
+Retrieve all the edges of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as destination and another as source. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<Edge<V,W>> |
+getEdgesOut(V vertex)
+Retrieve all the edges that goes OUT of a particular vertex.
++ Note: the edges that are returned are the one that have this vertex as source and another one as destination. + Note2: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<V> |
+getMarkedWith(java.lang.Object mark)
+Get all the vertices that are marked with the specific mark passed.
++ If there aren't vertices with that mark then it is returned an empty set. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
java.util.Collection<java.lang.Object> |
+getMarks(V vertex)
+Get all the marker of this vertex.
++ If the vertex doesn't have any mark, then it will return an empty set. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
Vertex<V> |
+getVertex(V vertex)
+Get an instance of the vertex linked with this graph.
++ For more info see Vertex |
+
W |
+getWeight(V vertex1,
+ V vertex2)
+Get the weight of the selected edge.
++ If the edge doesn't exist, then null is returned |
+
boolean |
+isCyclic()
+Tells if the graph has some cycle.
++ A cycle is detected if visiting the graph G starting from V1 (that is any of the vertex of G), + the visit can return to V1 in any point. |
+
boolean |
+isDAG()
+Tells if the graph has the property of DAG (Directed Acyclic Graph).
++ A graph is a DAG only if absent of any cycle. |
+
java.util.Iterator<V> |
+iterator() |
+
void |
+mark(V vertex,
+ java.lang.Object mark)
+Add to the specified vertex the mark passed.
++ A vertex can have multiple marker. |
+
java.util.Collection<java.lang.Object> |
+marks()
+Get all the marks of this graph.
++ Specifically it will return a collection of marks where every mark + as associated at least one vertex of the graph. + If the graph doesn't have vertex marked then it is returned an empty collection. |
+
int |
+numberOfEdges()
+Tells how many edges are in the graph.
+ |
+
int |
+numberOfVertices()
+Tells how many vertices are in the graph.
+ |
+
void |
+removeAllEdge()
+Remove all the edges of the graph.
++ After this method's call the graph will have only vertices, and no edge. |
+
void |
+removeAllEdge(V vertex)
+Remove all edges form a particular vertex of the graph.
++ After this method's call the selected vertex will have 0 edges. + It will be no longer possible to reach this vertex from any other vertex, and vice versa. |
+
void |
+removeAllInEdge(V vertex)
+Remove all the edges that goes in the vertex.
++ After this method's call it will be no longer possible travel to this vertex. |
+
void |
+removeAllOutEdge(V vertex)
+Remove all the edges that start from this vertex.
++ After this method's call it will be no longer possible travel to any vertex from this one. |
+
void |
+removeAllVertex()
+Remove all the vertex contained in the graph.
++ After this method's call the graph will be empty; no vertices nor edges. |
+
void |
+removeEdge(V vertex1,
+ V vertex2)
+Remove the edge between the two vertex.
++ If the edge doesn't exist, then this call does nothing. + After this method's call it will be no longer possible to travel from V1 to V2, nether from V2 to V1. |
+
void |
+removeVertex(V vertex)
+Remove the selected vertex from the graph.
++ After this method's call the vertex will be no longer present in the graph, and nether all his edges. |
+
java.util.Collection<java.util.Collection<V>> |
+stronglyConnectedComponents()
+The strongly connected components or disconnected components of an arbitrary directed graph
+ form a partition into subgraphs that are themselves strongly connected.
+ |
+
Graph<V,W> |
+subGraph(java.lang.Object... marker)
+Get a sub-graph of the current one with only the vertex marked with the selected markers.
++ Each vertex will have all his edges, but only the ones with the destination marked with the same marker. + If the marker is not specified or is null then the returning graph will have all the vertices that are not marked by any marker. + If the graph doesn't contain any vertex with that marker then an empty graph is returned. |
+
Graph<V,W> |
+subGraph(V source,
+ int depth)
+Get a sub-graph of the current one based on the maximum depth that is given.
++ If the depth is 1 then only the source and it's children will be in the sub-graph. + If the depth is 2 then only the source, it's children and it's children of it's children will be in the sub-graph. + And so on. + Of course the sub-graph will contain the edges that link the vertices, but only the one selected. |
+
java.util.List<V> |
+topologicalSort()
+If the current graph is a DAG, it returns a topological sort of this graph.
++ A topological ordering of a graph is a linear ordering of its vertices such that for + every directed edge (V1, V2) from vertex V1 to vertex V2, V2 comes before V1 in the ordering. |
+
Graph<V,W> |
+transpose()
+This method will create a new Graph that is the transposed version of the original.
++ At the end of this method the new graph will have all the edges inverted in orientation. + Example: if the graph G contains (V1, V2, V3) as vertex, and (V1->V2, V3->V2) as edges, + the transpose graph G' will contain (V1, V2, V3) as vertex, and (V2->V1, V2->V3) as edges. |
+
void |
+unMark(V vertex)
+Unmark the vertex selected.
++ After this call the vertex will not have any marked object to himself. |
+
void |
+unMark(V vertex,
+ java.lang.Object mark)
+Remove the selected mark from the vertex.
+ |
+
void |
+unMarkAll()
+Remove all the marker to all the vertex.
++ After this call the Graph.getMarks(Object) applied to any vertex will return an empty set |
+
void |
+unMarkAll(java.lang.Object mark)
+Remove the selected mark from all the vertices
+ |
+
java.util.Collection<V> |
+vertices()
+Get all the vertices in the graph.
++ If the graph doesn't contains vertices, it'll return an empty collection. + Note: depending on the implementation, modifying the returned collection + could affect the graph behavior and the changes could be reflected to the graph. |
+
VisitInfo<V> |
+visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph accordingly to the strategy that is passed.
++ This method visit the graph from the source to all the vertex that are reachable form the source. + Some strategy can accept a source vertex null, because they visit all the graph anyway. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic java.util.Iterator<V> iterator()+
iterator in interface java.lang.Iterable<V>public boolean isCyclic()+
Graphpublic boolean isDAG()+
GraphGraph.isCyclic() )public Vertex<V> getVertex(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphVertexpublic void addVertex(V vertex) + throws java.lang.NullPointerException+
Graphpublic boolean addVertexIfAbsent(V vertex) + throws java.lang.NullPointerException+
GraphGraph.contains(Object) returns true.addVertexIfAbsent in interface Graph<V,W extends java.lang.Number>vertex - the vertex to addjava.lang.NullPointerException - if the vertex is nullpublic void addAllVertices(java.util.Collection<V> vertices) + throws java.lang.NullPointerException+
GraphaddAllVertices in interface Graph<V,W extends java.lang.Number>vertices - a collection of the vertices to addjava.lang.NullPointerException - if the set is nullpublic void removeVertex(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveVertex in interface Graph<V,W extends java.lang.Number>vertex - the vertex to removejava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not containedpublic void removeAllVertex()+
GraphremoveAllVertex in interface Graph<V,W extends java.lang.Number>public boolean contains(V vertex) + throws java.lang.NullPointerException+
Graphpublic java.util.Collection<java.lang.Object> marks()+
Graphpublic void mark(V vertex, + java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic void unMark(V vertex, + java.lang.Object mark) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphunMark in interface Graph<V,W extends java.lang.Number>vertex - the vertex where remove the markmark - the mark to removejava.lang.NullPointerException - if a param is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic void unMark(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic java.util.Collection<V> getMarkedWith(java.lang.Object mark) + throws java.lang.NullPointerException+
GraphgetMarkedWith in interface Graph<V,W extends java.lang.Number>mark - the markjava.lang.NullPointerException - if the mark is nullpublic java.util.Collection<java.lang.Object> getMarks(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetMarks in interface Graph<V,W extends java.lang.Number>vertex - the vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic void unMarkAll(java.lang.Object mark) + throws java.lang.NullPointerException+
Graphpublic void unMarkAll()+
GraphGraph.getMarks(Object) applied to any vertex will return an empty setpublic W addEdge(V vertex1, + V vertex2, + W weight) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphweight - the weight of the edgejava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic W addEdge(Edge<V,W> edge) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdge in interface Graph<V,W extends java.lang.Number>edge - the edge to addjava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic W addEdgeAndVertices(V vertex1, + V vertex2, + W weight) + throws java.lang.NullPointerException+
GraphaddEdgeAndVertices in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphweight - the weight of the edgejava.lang.NullPointerException - if one of the parameter is nullpublic W addEdgeAndVertices(Edge<V,W> edge) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphaddEdgeAndVertices in interface Graph<V,W extends java.lang.Number>edge - the edge to addjava.lang.NullPointerException - if one of the parameter is nulljava.lang.IllegalArgumentExceptionpublic void addAllEdges(java.util.Collection<Edge<V,W>> edges) + throws java.lang.NullPointerException+
GraphaddAllEdges in interface Graph<V,W extends java.lang.Number>edges - the edges to addjava.lang.NullPointerException - if the set is nullpublic W getWeight(V vertex1, + V vertex2) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetWeight in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeEdge(V vertex1, + V vertex2) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllInEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllInEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllOutEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllOutEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllEdge(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphremoveAllEdge in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic void removeAllEdge()+
GraphremoveAllEdge in interface Graph<V,W extends java.lang.Number>public boolean containsEdge(V vertex1, + V vertex2) + throws java.lang.NullPointerException+
GraphcontainsEdge in interface Graph<V,W extends java.lang.Number>vertex1 - a vertex of the graphvertex2 - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nullpublic java.util.Collection<V> vertices()+
Graphpublic java.util.Collection<Edge<V,W>> edges()+
Graphpublic java.util.Collection<Edge<V,W>> edgesOf(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphpublic java.util.Collection<Edge<V,W>> getEdgesIn(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetEdgesIn in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<Edge<V,W>> getEdgesOut(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetEdgesOut in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<V> getChildren(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphgetChildren in interface Graph<V,W extends java.lang.Number>vertex - the source vertexjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic java.util.Collection<V> getAncestors(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphGraph.getChildren(Object)getAncestors in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if one of the parameters is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphpublic int degreeIn(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphdegreeIn in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int degreeOut(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphdegreeOut in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int degree(V vertex) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphdegree in interface Graph<V,W extends java.lang.Number>vertex - a vertex of the graphjava.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not contained in the graphpublic int numberOfVertices()+
GraphnumberOfVertices in interface Graph<V,W extends java.lang.Number>public int numberOfEdges()+
GraphnumberOfEdges in interface Graph<V,W extends java.lang.Number>public VisitInfo<V> visit(V source, + VisitStrategy<V,W> strategy, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphvisit in interface Graph<V,W extends java.lang.Number>source - the source vertex of the visitstrategy - the algorithm for visiting the graphvisit - the function to apply at each vertexjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphpublic Graph<V,W> transpose()+
Graphpublic java.util.List<V> topologicalSort() + throws java.lang.UnsupportedOperationException+
GraphtopologicalSort in interface Graph<V,W extends java.lang.Number>java.lang.UnsupportedOperationException - if the graph is not a DAG (see Graph.isDAG())public java.util.Collection<java.util.Collection<V>> stronglyConnectedComponents()+
GraphstronglyConnectedComponents in interface Graph<V,W extends java.lang.Number>public Graph<V,W> subGraph(V source, + int depth) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
GraphsubGraph in interface Graph<V,W extends java.lang.Number>source - the source vertexdepth - the maximum depth (must be a positive number, if >=0 a graph containing only the source is returned)java.lang.NullPointerException - if the vertex is nulljava.lang.IllegalArgumentException - if the vertex is not containedpublic Graph<V,W> subGraph(java.lang.Object... marker)+
Graphpublic java.util.List<Edge<V,W>> distance(V source, + V destination) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException, + java.lang.UnsupportedOperationException+
Graphdistance in interface Graph<V,W extends java.lang.Number>source - the vertex where to startdestination - the destination chosenjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graphjava.lang.UnsupportedOperationException - if from the source it's not possible to reach the destinationpublic java.util.Map<V,java.util.List<Edge<V,W>>> distance(V source) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
Graphdistance in interface Graph<V,W extends java.lang.Number>source - the vertex where to startjava.lang.NullPointerException - if one of the parameter is null (except the consumer)java.lang.IllegalArgumentException - if the vertex is not in the graph| Class | +Description | +
|---|---|
| AdjGraph<V,W extends java.lang.Number> | ++ |
| MapGraph<V,W extends java.lang.Number> | +
+ Graph that uses HashMap for vertices and edges
++ More specifically it utilizes a Map containing all the vertices mapped to all their edges + Technically this version of the graph combine the fast adding/removing of the edges of the Matrix implementation, + with the low memory and fast adding/removing of vertices of the Linked List implementation. + This happen if the HashMap is not reallocated. |
+
| MatrixGraph<V,W extends java.lang.Number> | ++ |
public class EdgeSaveStructure
+extends java.lang.Object
+| Modifier and Type | +Field and Description | +
|---|---|
java.lang.String |
+dest |
+
java.lang.String |
+src |
+
java.lang.String |
+weight |
+
| Modifier | +Constructor and Description | +
|---|---|
|
+EdgeSaveStructure() |
+
protected |
+EdgeSaveStructure(java.lang.String s,
+ java.lang.String d,
+ java.lang.String w) |
+
public class GraphSaveStructure
+extends java.lang.Object
+| Modifier and Type | +Field and Description | +
|---|---|
EdgeSaveStructure[] |
+edges |
+
java.lang.String |
+other |
+
java.lang.String[] |
+vertices |
+
| Constructor and Description | +
|---|
GraphSaveStructure() |
+
GraphSaveStructure(Graph<?,?> graph,
+ java.lang.String other) |
+
public java.lang.String[] vertices+
public EdgeSaveStructure[] edges+
public java.lang.String other+
public class MarkSaveStructure
+extends java.lang.Object
+| Modifier and Type | +Field and Description | +
|---|---|
java.lang.Object |
+mark |
+
java.lang.String |
+vert |
+
| Modifier | +Constructor and Description | +
|---|---|
|
+MarkSaveStructure() |
+
protected |
+MarkSaveStructure(java.lang.String v,
+ java.lang.Object m) |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph.models | ++ |
| Modifier and Type | +Field and Description | +
|---|---|
EdgeSaveStructure[] |
+GraphSaveStructure.edges |
+
| Class | +Description | +
|---|---|
| EdgeSaveStructure | +
+ Support class used for saving a Graph in a file.
+ |
+
| GraphSaveStructure | +
+ Support class used for saving a Graph in a file.
+ |
+
| MarkSaveStructure | +
+ Support class used for saving a Graph in a file.
+ |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph.models | ++ |
| Class and Description | +
|---|
| EdgeSaveStructure
+ Support class used for saving a Graph in a file.
+ |
+
| Interface | +Description | +
|---|---|
| Graph<V,W extends java.lang.Number> | +
+ An interface for the graphs.
++ This interface is used for the graphs with Directed edges. + A directed edge between V1 and V2 is an edge that has V1 as source and V2 as destination. |
+
| Class | +Description | +
|---|---|
| Edge<V,W extends java.lang.Number> | +
+ Class used for retrieving the edges of the graph.
+ |
+
| Vertex<V> | +
+ Class used for represent a vertex of the graph.
++ The vertex contained is linked with the graph, so if any changes are made to + it, then they will be reflected here. |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.models | ++ |
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.vertex | ++ |
| berack96.lib.graph.visit | ++ |
| berack96.lib.graph.visit.impl | ++ |
| Class and Description | +
|---|
| Edge
+ Class used for retrieving the edges of the graph.
+ |
+
| Graph
+ An interface for the graphs.
++ This interface is used for the graphs with Directed edges. + A directed edge between V1 and V2 is an edge that has V1 as source and V2 as destination. |
+
| Vertex
+ Class used for represent a vertex of the graph.
++ The vertex contained is linked with the graph, so if any changes are made to + it, then they will be reflected here. |
+
| Class and Description | +
|---|
| Edge
+ Class used for retrieving the edges of the graph.
+ |
+
| Graph
+ An interface for the graphs.
++ This interface is used for the graphs with Directed edges. + A directed edge between V1 and V2 is an edge that has V1 as source and V2 as destination. |
+
| Vertex
+ Class used for represent a vertex of the graph.
++ The vertex contained is linked with the graph, so if any changes are made to + it, then they will be reflected here. |
+
| Class and Description | +
|---|
| Graph
+ An interface for the graphs.
++ This interface is used for the graphs with Directed edges. + A directed edge between V1 and V2 is an edge that has V1 as source and V2 as destination. |
+
| Class and Description | +
|---|
| Edge
+ Class used for retrieving the edges of the graph.
+ |
+
| Graph
+ An interface for the graphs.
++ This interface is used for the graphs with Directed edges. + A directed edge between V1 and V2 is an edge that has V1 as source and V2 as destination. |
+
| Class and Description | +
|---|
| Edge
+ Class used for retrieving the edges of the graph.
+ |
+
| Vertex
+ Class used for represent a vertex of the graph.
++ The vertex contained is linked with the graph, so if any changes are made to + it, then they will be reflected here. |
+
| Class and Description | +
|---|
| Graph
+ An interface for the graphs.
++ This interface is used for the graphs with Directed edges. + A directed edge between V1 and V2 is an edge that has V1 as source and V2 as destination. |
+
| Vertex
+ Class used for represent a vertex of the graph.
++ The vertex contained is linked with the graph, so if any changes are made to + it, then they will be reflected here. |
+
| Class and Description | +
|---|
| Edge
+ Class used for retrieving the edges of the graph.
+ |
+
| Graph
+ An interface for the graphs.
++ This interface is used for the graphs with Directed edges. + A directed edge between V1 and V2 is an edge that has V1 as source and V2 as destination. |
+
| Class and Description | +
|---|
| Edge
+ Class used for retrieving the edges of the graph.
+ |
+
| Graph
+ An interface for the graphs.
++ This interface is used for the graphs with Directed edges. + A directed edge between V1 and V2 is an edge that has V1 as source and V2 as destination. |
+
public class GraphInfo<V,W extends java.lang.Number>
+extends javax.swing.JPanel
+javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponentjava.awt.Container.AccessibleAWTContainerjava.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategylistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description | +
|---|
GraphInfo(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener,
+ java.util.Set<VisitStrategy<V,W>> visits) |
+
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic GraphInfo(GraphPanel<V,W> graphPanel, + VertexListener<V> vListener, + EdgeListener<V,W> eListener, + java.util.Set<VisitStrategy<V,W>> visits)+
public interface GraphListener
+extends java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener
+| Modifier and Type | +Method and Description | +
|---|---|
java.lang.String |
+getDescription()
+Get the description of this listener, in a way to interact with the user.
+ |
+
void |
+remove()
+Remove the listener to the graph.
+ |
+
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleasedmouseDragged, mouseMovedkeyPressed, keyReleased, keyTypedvoid remove()+
java.lang.String getDescription()+
public class GraphPanel<V,W extends java.lang.Number>
+extends java.awt.Component
+java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategyaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description | +
|---|
GraphPanel(GraphicalView<VertexComponent<V>> vertexRender,
+ GraphicalView<EdgeComponent<V,W>> edgeRender,
+ java.lang.Class<V> classV,
+ java.lang.Class<W> classW) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+addEdge(Edge<V,W> edge) |
+
void |
+addEdge(VertexComponent<V> source,
+ VertexComponent<V> dest,
+ W weight) |
+
void |
+addObserver(java.util.Observer observer) |
+
void |
+addVertex(java.awt.Point center,
+ V vertex) |
+
EdgeComponent<V,W> |
+getEdgeAt(java.awt.Point point) |
+
Graph<V,W> |
+getGraph() |
+
VertexComponent<V> |
+getVertexAt(java.awt.Point point) |
+
void |
+load(java.lang.String fileName) |
+
void |
+modEdge(VertexComponent<V> source,
+ VertexComponent<V> dest,
+ W weight) |
+
void |
+moveVertex(VertexComponent<V> vertex,
+ java.awt.Point destination) |
+
void |
+paint(java.awt.Graphics g) |
+
void |
+removeEdge(VertexComponent<V> source,
+ VertexComponent<V> dest) |
+
void |
+removeObserver(java.util.Observer observer) |
+
void |
+removeVertex(java.awt.Point center) |
+
void |
+save(java.lang.String fileName) |
+
void |
+setBounds(int x,
+ int y,
+ int width,
+ int height) |
+
void |
+setGraphListener(GraphListener listener) |
+
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic GraphPanel(GraphicalView<VertexComponent<V>> vertexRender, + GraphicalView<EdgeComponent<V,W>> edgeRender, + java.lang.Class<V> classV, + java.lang.Class<W> classW)+
public void setGraphListener(GraphListener listener)+
public void addVertex(java.awt.Point center, + V vertex)+
public void removeVertex(java.awt.Point center)+
public void moveVertex(VertexComponent<V> vertex, + java.awt.Point destination)+
public void addEdge(VertexComponent<V> source, + VertexComponent<V> dest, + W weight)+
public void removeEdge(VertexComponent<V> source, + VertexComponent<V> dest)+
public void modEdge(VertexComponent<V> source, + VertexComponent<V> dest, + W weight)+
public VertexComponent<V> getVertexAt(java.awt.Point point)+
public EdgeComponent<V,W> getEdgeAt(java.awt.Point point)+
public void addObserver(java.util.Observer observer)+
public void removeObserver(java.util.Observer observer)+
public void save(java.lang.String fileName) + throws java.io.IOException+
java.io.IOExceptionpublic void load(java.lang.String fileName) + throws java.io.IOException+
java.io.IOExceptionpublic void setBounds(int x, + int y, + int width, + int height)+
setBounds in class java.awt.Componentpublic void paint(java.awt.Graphics g)+
paint in class java.awt.Componentpublic class GraphWindow<V,W extends java.lang.Number>
+extends javax.swing.JFrame
+javax.swing.JFrame.AccessibleJFramejava.awt.Frame.AccessibleAWTFramejava.awt.Window.AccessibleAWTWindow, java.awt.Window.Typejava.awt.Container.AccessibleAWTContainerjava.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategyaccessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabledCROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSORBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSEABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description | +
|---|
GraphWindow(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener) |
+
| Modifier and Type | +Method and Description | +
|---|---|
GraphPanel<V,W> |
+getGraphPanel() |
+
void |
+visitRefresh(int millisec) |
+
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateaddNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecoratedaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFrontadd, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetFont, postEventpublic GraphWindow(GraphPanel<V,W> graphPanel, + VertexListener<V> vListener, + EdgeListener<V,W> eListener)+
O - the object to paintpublic interface GraphicalView<O>
+| Modifier and Type | +Method and Description | +
|---|---|
java.awt.Rectangle |
+getBox(O obj,
+ java.awt.Point center)
+Box where the object is sensible at listeners (like Hitbox)
+ |
+
void |
+paint(java.awt.Graphics2D g2,
+ O obj,
+ java.awt.Point center)
+The paint function, aka the part where you can draw things (like Mesh)
+ |
+
java.awt.Rectangle getBox(O obj, + java.awt.Point center)+
obj - the object to drawcenter - the center point of the objectvoid paint(java.awt.Graphics2D g2, + O obj, + java.awt.Point center)+
g2 - the graphics object used for paintingobj - the object to paintcenter - the center point of the objectpublic class Main
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
static void |
+main(java.lang.String[] args) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class VisitListener<V> +extends java.lang.Object +implements GraphListener+
| Constructor and Description | +
|---|
VisitListener(GraphPanel<V,?> panel,
+ VisitStrategy<V,?> strategy) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static void |
+changeRefresh(int millisec) |
+
java.lang.String |
+getDescription()
+Get the description of this listener, in a way to interact with the user.
+ |
+
void |
+keyPressed(java.awt.event.KeyEvent e) |
+
void |
+keyReleased(java.awt.event.KeyEvent e) |
+
void |
+keyTyped(java.awt.event.KeyEvent e) |
+
void |
+mouseClicked(java.awt.event.MouseEvent e) |
+
void |
+mouseDragged(java.awt.event.MouseEvent e) |
+
void |
+mouseEntered(java.awt.event.MouseEvent e) |
+
void |
+mouseExited(java.awt.event.MouseEvent e) |
+
void |
+mouseMoved(java.awt.event.MouseEvent e) |
+
void |
+mousePressed(java.awt.event.MouseEvent e) |
+
void |
+mouseReleased(java.awt.event.MouseEvent e) |
+
void |
+remove()
+Remove the listener to the graph.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic VisitListener(GraphPanel<V,?> panel, + VisitStrategy<V,?> strategy)+
public static void changeRefresh(int millisec)+
public void remove()+
GraphListenerremove in interface GraphListenerpublic java.lang.String getDescription()+
GraphListenergetDescription in interface GraphListenerpublic void mousePressed(java.awt.event.MouseEvent e)+
mousePressed in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)+
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)+
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)+
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)+
mouseExited in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)+
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)+
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void keyPressed(java.awt.event.KeyEvent e)+
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)+
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)+
keyTyped in interface java.awt.event.KeyListener| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.vertex | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+VisitListener<V> |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+GraphPanel.setGraphListener(GraphListener listener) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+EdgeIntListener<V> |
+
class |
+EdgeListener<V,W extends java.lang.Number> |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+VertexIntListener |
+
class |
+VertexListener<V> |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.vertex | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
GraphPanel<V,W> |
+GraphWindow.getGraphPanel() |
+
| Constructor and Description | +
|---|
GraphInfo(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener,
+ java.util.Set<VisitStrategy<V,W>> visits) |
+
GraphWindow(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener) |
+
VisitListener(GraphPanel<V,?> panel,
+ VisitStrategy<V,?> strategy) |
+
| Constructor and Description | +
|---|
EdgeIntListener(GraphPanel<V,java.lang.Integer> graphPanel) |
+
EdgeListener(GraphPanel<V,W> graphPanel) |
+
| Modifier and Type | +Field and Description | +
|---|---|
protected GraphPanel<V,?> |
+VertexListener.panel |
+
| Constructor and Description | +
|---|
VertexIntListener(GraphPanel<java.lang.Integer,?> panel) |
+
VertexListener(GraphPanel<V,?> panel) |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.vertex | ++ |
| Constructor and Description | +
|---|
GraphPanel(GraphicalView<VertexComponent<V>> vertexRender,
+ GraphicalView<EdgeComponent<V,W>> edgeRender,
+ java.lang.Class<V> classV,
+ java.lang.Class<W> classW) |
+
GraphPanel(GraphicalView<VertexComponent<V>> vertexRender,
+ GraphicalView<EdgeComponent<V,W>> edgeRender,
+ java.lang.Class<V> classV,
+ java.lang.Class<W> classW) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+EdgeView<V,W extends java.lang.Number> |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+VertexView<V> |
+
public class EdgeComponent<V,W extends java.lang.Number>
+extends java.awt.Component
+java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy| Modifier and Type | +Field and Description | +
|---|---|
VertexComponent<V> |
+destination |
+
Edge<V,W> |
+edge |
+
VertexComponent<V> |
+source |
+
W |
+weight |
+
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description | +
|---|
EdgeComponent(VertexComponent<V> source,
+ VertexComponent<V> destination,
+ W weight) |
+
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic final VertexComponent<V> source+
public final VertexComponent<V> destination+
public final W extends java.lang.Number weight+
public EdgeComponent(VertexComponent<V> source, + VertexComponent<V> destination, + W weight)+
public class EdgeIntListener<V> +extends EdgeListener<V,java.lang.Integer>+
| Constructor and Description | +
|---|
EdgeIntListener(GraphPanel<V,java.lang.Integer> graphPanel) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.Integer |
+buildEdgeFrom(java.lang.String string) |
+
protected java.lang.Integer |
+buildNewEdge(Vertex<V> vertex,
+ Vertex<V> vertex1) |
+
void |
+remove()
+Remove the listener to the graph.
+ |
+
getDescription, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleasedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic EdgeIntListener(GraphPanel<V,java.lang.Integer> graphPanel)+
public void remove()+
GraphListenerprotected java.lang.Integer buildNewEdge(Vertex<V> vertex, + Vertex<V> vertex1)+
buildNewEdge in class EdgeListener<V,java.lang.Integer>protected java.lang.Integer buildEdgeFrom(java.lang.String string)+
buildEdgeFrom in class EdgeListener<V,java.lang.Integer>public abstract class EdgeListener<V,W extends java.lang.Number> +extends java.lang.Object +implements GraphListener+
| Constructor and Description | +
|---|
EdgeListener(GraphPanel<V,W> graphPanel) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected abstract W |
+buildEdgeFrom(java.lang.String string) |
+
protected abstract W |
+buildNewEdge(Vertex<V> vertex,
+ Vertex<V> vertex1) |
+
java.lang.String |
+getDescription()
+Get the description of this listener, in a way to interact with the user.
+ |
+
void |
+keyPressed(java.awt.event.KeyEvent e) |
+
void |
+keyReleased(java.awt.event.KeyEvent e) |
+
void |
+keyTyped(java.awt.event.KeyEvent e) |
+
void |
+mouseClicked(java.awt.event.MouseEvent e) |
+
void |
+mouseDragged(java.awt.event.MouseEvent e) |
+
void |
+mouseEntered(java.awt.event.MouseEvent e) |
+
void |
+mouseExited(java.awt.event.MouseEvent e) |
+
void |
+mouseMoved(java.awt.event.MouseEvent e) |
+
void |
+mousePressed(java.awt.event.MouseEvent e) |
+
void |
+mouseReleased(java.awt.event.MouseEvent e) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitremovepublic EdgeListener(GraphPanel<V,W> graphPanel)+
protected abstract W buildEdgeFrom(java.lang.String string)+
public java.lang.String getDescription()+
GraphListenergetDescription in interface GraphListenerpublic void mousePressed(java.awt.event.MouseEvent e)+
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)+
mouseReleased in interface java.awt.event.MouseListenerpublic void keyPressed(java.awt.event.KeyEvent e)+
keyPressed in interface java.awt.event.KeyListenerpublic void mouseDragged(java.awt.event.MouseEvent e)+
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseClicked(java.awt.event.MouseEvent e)+
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)+
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)+
mouseExited in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)+
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void keyReleased(java.awt.event.KeyEvent e)+
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)+
keyTyped in interface java.awt.event.KeyListenerpublic class EdgeView<V,W extends java.lang.Number> +extends java.lang.Object +implements GraphicalView<EdgeComponent<V,W>>+
| Modifier and Type | +Method and Description | +
|---|---|
java.awt.Rectangle |
+getBox(EdgeComponent<V,W> edge,
+ java.awt.Point center)
+Box where the object is sensible at listeners (like Hitbox)
+ |
+
void |
+paint(java.awt.Graphics2D g2,
+ EdgeComponent<V,W> edge,
+ java.awt.Point center)
+The paint function, aka the part where you can draw things (like Mesh)
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic java.awt.Rectangle getBox(EdgeComponent<V,W> edge, + java.awt.Point center)+
GraphicalViewgetBox in interface GraphicalView<EdgeComponent<V,W extends java.lang.Number>>edge - the object to drawcenter - the center point of the objectpublic void paint(java.awt.Graphics2D g2, + EdgeComponent<V,W> edge, + java.awt.Point center)+
GraphicalViewpaint in interface GraphicalView<EdgeComponent<V,W extends java.lang.Number>>g2 - the graphics object used for paintingedge - the object to paintcenter - the center point of the object| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
EdgeComponent<V,W> |
+GraphPanel.getEdgeAt(java.awt.Point point) |
+
| Constructor and Description | +
|---|
GraphPanel(GraphicalView<VertexComponent<V>> vertexRender,
+ GraphicalView<EdgeComponent<V,W>> edgeRender,
+ java.lang.Class<V> classV,
+ java.lang.Class<W> classW) |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.awt.Rectangle |
+EdgeView.getBox(EdgeComponent<V,W> edge,
+ java.awt.Point center) |
+
void |
+EdgeView.paint(java.awt.Graphics2D g2,
+ EdgeComponent<V,W> edge,
+ java.awt.Point center) |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| Constructor and Description | +
|---|
GraphInfo(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener,
+ java.util.Set<VisitStrategy<V,W>> visits) |
+
GraphWindow(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+EdgeIntListener<V> |
+
| Class | +Description | +
|---|---|
| EdgeComponent<V,W extends java.lang.Number> | ++ |
| EdgeIntListener<V> | ++ |
| EdgeListener<V,W extends java.lang.Number> | ++ |
| EdgeView<V,W extends java.lang.Number> | ++ |
| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| Class and Description | +
|---|
| EdgeComponent | +
| EdgeListener | +
| Class and Description | +
|---|
| EdgeComponent | +
| EdgeListener | +
| Interface | +Description | +
|---|---|
| GraphicalView<O> | +
+ An interface for divide the "hitbox" and the "paint" of the various items
+ |
+
| GraphListener | +
+ An interface for creating a listener of the Graph.
+ |
+
| Class | +Description | +
|---|---|
| GraphInfo<V,W extends java.lang.Number> | ++ |
| GraphPanel<V,W extends java.lang.Number> | ++ |
| GraphWindow<V,W extends java.lang.Number> | +
+ This class is the Window that appear for building the graph and playing around with it
+ |
+
| Main | ++ |
| VisitListener<V> | ++ |
| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.vertex | ++ |
| Class and Description | +
|---|
| GraphicalView
+ An interface for divide the "hitbox" and the "paint" of the various items
+ |
+
| GraphListener
+ An interface for creating a listener of the Graph.
+ |
+
| GraphPanel | +
| Class and Description | +
|---|
| GraphicalView
+ An interface for divide the "hitbox" and the "paint" of the various items
+ |
+
| GraphListener
+ An interface for creating a listener of the Graph.
+ |
+
| GraphPanel | +
| Class and Description | +
|---|
| GraphicalView
+ An interface for divide the "hitbox" and the "paint" of the various items
+ |
+
| GraphListener
+ An interface for creating a listener of the Graph.
+ |
+
| GraphPanel | +
public class Arrow
+extends java.awt.Polygon
+bounds, npoints, xpoints, ypoints| Constructor and Description | +
|---|
Arrow(java.awt.Point start,
+ java.awt.Point end,
+ int size,
+ int headSize)
+Create an arrow
+ |
+
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset, translateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Arrow(java.awt.Point start, + java.awt.Point end, + int size, + int headSize)+
start - the starting point of your arrow (the base)end - the ending point of your arrow (the head)size - the size of the arrow baseheadSize - the size of the arrow's head| Class | +Description | +
|---|---|
| Arrow | +
+ Class that create a Polygon that has a shape of an arrow
+ |
+
public class VertexComponent<V>
+extends java.awt.Component
+java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy| Modifier and Type | +Field and Description | +
|---|---|
Vertex<V> |
+vertex |
+
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description | +
|---|
VertexComponent(Vertex<V> vertex) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+equals(java.lang.Object obj) |
+
java.lang.String |
+toString() |
+
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validateclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic class VertexIntListener +extends VertexListener<java.lang.Integer>+
panel| Constructor and Description | +
|---|
VertexIntListener(GraphPanel<java.lang.Integer,?> panel) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.Integer |
+buildNewVertex(Graph<java.lang.Integer,?> graph) |
+
void |
+remove()
+Remove the listener to the graph.
+ |
+
getDescription, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleasedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic VertexIntListener(GraphPanel<java.lang.Integer,?> panel)+
public void remove()+
GraphListenerprotected java.lang.Integer buildNewVertex(Graph<java.lang.Integer,?> graph)+
buildNewVertex in class VertexListener<java.lang.Integer>public abstract class VertexListener<V> +extends java.lang.Object +implements GraphListener+
| Modifier and Type | +Field and Description | +
|---|---|
protected GraphPanel<V,?> |
+panel |
+
| Constructor and Description | +
|---|
VertexListener(GraphPanel<V,?> panel) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected abstract V |
+buildNewVertex(Graph<V,?> graph) |
+
java.lang.String |
+getDescription()
+Get the description of this listener, in a way to interact with the user.
+ |
+
void |
+keyPressed(java.awt.event.KeyEvent e) |
+
void |
+keyReleased(java.awt.event.KeyEvent e) |
+
void |
+keyTyped(java.awt.event.KeyEvent e) |
+
void |
+mouseClicked(java.awt.event.MouseEvent e) |
+
void |
+mouseDragged(java.awt.event.MouseEvent e) |
+
void |
+mouseEntered(java.awt.event.MouseEvent e) |
+
void |
+mouseExited(java.awt.event.MouseEvent e) |
+
void |
+mouseMoved(java.awt.event.MouseEvent e) |
+
void |
+mousePressed(java.awt.event.MouseEvent e) |
+
void |
+mouseReleased(java.awt.event.MouseEvent e) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitremoveprotected final GraphPanel<V,?> panel+
public VertexListener(GraphPanel<V,?> panel)+
public java.lang.String getDescription()+
GraphListenergetDescription in interface GraphListenerpublic void mousePressed(java.awt.event.MouseEvent e)+
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)+
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)+
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseClicked(java.awt.event.MouseEvent e)+
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)+
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)+
mouseExited in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)+
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void keyPressed(java.awt.event.KeyEvent e)+
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)+
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)+
keyTyped in interface java.awt.event.KeyListenerpublic class VertexView<V> +extends java.lang.Object +implements GraphicalView<VertexComponent<V>>+
| Constructor and Description | +
|---|
VertexView() |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.awt.Rectangle |
+getBox(VertexComponent<V> obj,
+ java.awt.Point center)
+Box where the object is sensible at listeners (like Hitbox)
+ |
+
void |
+paint(java.awt.Graphics2D g2,
+ VertexComponent<V> obj,
+ java.awt.Point center)
+The paint function, aka the part where you can draw things (like Mesh)
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic java.awt.Rectangle getBox(VertexComponent<V> obj, + java.awt.Point center)+
GraphicalViewgetBox in interface GraphicalView<VertexComponent<V>>obj - the object to drawcenter - the center point of the objectpublic void paint(java.awt.Graphics2D g2, + VertexComponent<V> obj, + java.awt.Point center)+
GraphicalViewpaint in interface GraphicalView<VertexComponent<V>>g2 - the graphics object used for paintingobj - the object to paintcenter - the center point of the object| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.vertex | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
VertexComponent<V> |
+GraphPanel.getVertexAt(java.awt.Point point) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+GraphPanel.addEdge(VertexComponent<V> source,
+ VertexComponent<V> dest,
+ W weight) |
+
void |
+GraphPanel.addEdge(VertexComponent<V> source,
+ VertexComponent<V> dest,
+ W weight) |
+
void |
+GraphPanel.modEdge(VertexComponent<V> source,
+ VertexComponent<V> dest,
+ W weight) |
+
void |
+GraphPanel.modEdge(VertexComponent<V> source,
+ VertexComponent<V> dest,
+ W weight) |
+
void |
+GraphPanel.moveVertex(VertexComponent<V> vertex,
+ java.awt.Point destination) |
+
void |
+GraphPanel.removeEdge(VertexComponent<V> source,
+ VertexComponent<V> dest) |
+
void |
+GraphPanel.removeEdge(VertexComponent<V> source,
+ VertexComponent<V> dest) |
+
| Constructor and Description | +
|---|
GraphPanel(GraphicalView<VertexComponent<V>> vertexRender,
+ GraphicalView<EdgeComponent<V,W>> edgeRender,
+ java.lang.Class<V> classV,
+ java.lang.Class<W> classW) |
+
| Modifier and Type | +Field and Description | +
|---|---|
VertexComponent<V> |
+EdgeComponent.destination |
+
VertexComponent<V> |
+EdgeComponent.source |
+
| Constructor and Description | +
|---|
EdgeComponent(VertexComponent<V> source,
+ VertexComponent<V> destination,
+ W weight) |
+
EdgeComponent(VertexComponent<V> source,
+ VertexComponent<V> destination,
+ W weight) |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.awt.Rectangle |
+VertexView.getBox(VertexComponent<V> obj,
+ java.awt.Point center) |
+
void |
+VertexView.paint(java.awt.Graphics2D g2,
+ VertexComponent<V> obj,
+ java.awt.Point center) |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.vertex | ++ |
| Constructor and Description | +
|---|
GraphInfo(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener,
+ java.util.Set<VisitStrategy<V,W>> visits) |
+
GraphWindow(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener) |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+VertexIntListener |
+
| Class | +Description | +
|---|---|
| VertexComponent<V> | ++ |
| VertexIntListener | ++ |
| VertexListener<V> | ++ |
| VertexView<V> | ++ |
| Package | +Description | +
|---|---|
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.vertex | ++ |
| Class and Description | +
|---|
| VertexComponent | +
| VertexListener | +
| Class and Description | +
|---|
| VertexComponent | +
| Class and Description | +
|---|
| VertexComponent | +
| VertexListener | +
V - the vertexW - the weightpublic interface VisitDistSourceDest<V,W extends java.lang.Number> +extends VisitStrategy<V,W>+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.List<Edge<V,W>> |
+distance(Graph<V,W> graph,
+ V source,
+ V destination)
+Get the distance from the source to the destination
++ The list contains the minimum path from the vertex marked as source to the destination vertex |
+
visitjava.util.List<Edge<V,W>> distance(Graph<V,W> graph, + V source, + V destination) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
graph - the graph were to find the min pathsource - the source vertexdestination - the destination vertexjava.lang.NullPointerException - if one of the vertex is nulljava.lang.IllegalArgumentException - if one of the vertex is not contained in the graphV - the vertexW - the weightpublic interface VisitDistance<V,W extends java.lang.Number> +extends VisitStrategy<V,W>+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.Map<V,java.util.List<Edge<V,W>>> |
+getLastDistance()
+Get the last calculated distance to all the possible destinations
++ The map contains all the possible vertices that are reachable from the source set in the visit + If there is no path between the destination and the source, then null is returned as accordingly to the map interface + If the visit is not already been done, then the map is null. |
+
V |
+getLastSource()
+Get the last source vertex of the visit for calculating the destinations.
++ Returns null if the visit is not already been done |
+
visitjava.util.Map<V,java.util.List<Edge<V,W>>> getLastDistance() + throws java.lang.NullPointerException+
java.lang.NullPointerException - if the visit is not already been doneV getLastSource()+
V - the vertexW - the weightpublic interface VisitSCC<V,W extends java.lang.Number> +extends VisitStrategy<V,W>+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.Collection<java.util.Collection<V>> |
+getSCC()
+Return the latest calculated strongly connected components of the graph.
+ |
+
visitV - The Object that represent a vertexW - The Object that represent the edge (more specifically the weight of the edge)public interface VisitStrategy<V,W extends java.lang.Number>
+| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+With this the graph will be visited accordingly to the strategy of the visit.
++ Some strategy can accept a source vertex null, because they visit all the graph anyway. + If you want to stop the visit of the graph, you just have to throw any exception in the visit function, but be sure to catch it |
+
VisitInfo<V> visit(Graph<V,W> graph, + V source, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException, + java.lang.UnsupportedOperationException+
graph - the graph to visitsource - the source of the visitvisit - the function to apply at each vertex when they are visitedjava.lang.NullPointerException - if one of the arguments is null (only the consumers can be null)java.lang.IllegalArgumentException - if the source vertex is not in the graphjava.lang.UnsupportedOperationException - in the case that the visit algorithm cannot be applied to the graphV - the vertexW - the weightpublic interface VisitTopological<V,W extends java.lang.Number> +extends VisitStrategy<V,W>+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.List<V> |
+getTopologicalSort()
+Return the latest calculated Topological sort of the graph.
++ If the latest visited graph is not a DAG, it will return null. |
+
visitjava.util.List<V> getTopologicalSort()+
java.lang.NullPointerException - if there is no last calculated topological sort| Package | +Description | +
|---|---|
| berack96.lib.graph.visit.impl | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Dijkstra<V,W extends java.lang.Number>
+Class that implements the Dijkstra algorithm and uses it for getting all the distance from a source
+ |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph.visit.impl | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Tarjan<V,W extends java.lang.Number>
+Class that implements the Tarjan algorithm and uses it for getting the SCC and the topological sort
+ |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.visit | ++ |
| berack96.lib.graph.visit.impl | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+Vertex.visit(VisitStrategy strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph from this current vertex with the strategy assigned
+ |
+
VisitInfo<V> |
+Graph.visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph accordingly to the strategy that is passed.
++ This method visit the graph from the source to all the vertex that are reachable form the source. + Some strategy can accept a source vertex null, because they visit all the graph anyway. |
+
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+MatrixGraph.visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit) |
+
VisitInfo<V> |
+MapGraph.visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit) |
+
VisitInfo<V> |
+AdjGraph.visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit) |
+
| Constructor and Description | +
|---|
VisitListener(GraphPanel<V,?> panel,
+ VisitStrategy<V,?> strategy) |
+
| Constructor and Description | +
|---|
GraphInfo(GraphPanel<V,W> graphPanel,
+ VertexListener<V> vListener,
+ EdgeListener<V,W> eListener,
+ java.util.Set<VisitStrategy<V,W>> visits) |
+
| Modifier and Type | +Interface and Description | +
|---|---|
interface |
+VisitDistance<V,W extends java.lang.Number>
+Interface that is helpful for implements visit that needs to retrieve the distance between a vertex to all the others
+ |
+
interface |
+VisitDistSourceDest<V,W extends java.lang.Number>
+Interface that is helpful for implements visit that needs to retrieve the distance between a vertex to all the others
+ |
+
interface |
+VisitSCC<V,W extends java.lang.Number>
+Interface that is helpful for implements visit that needs to retrieve the SCC
+ |
+
interface |
+VisitTopological<V,W extends java.lang.Number>
+Interface that is helpful for implements visit that needs to retrieve the topological sort
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+BFS<V,W extends java.lang.Number>
+Breadth-first search
++ The algorithm starts at the root node and explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level. |
+
class |
+DFS<V,W extends java.lang.Number>
+Depth-first search
++ The algorithm starts at the root node and explores as far as possible along each branch before backtracking. |
+
class |
+Dijkstra<V,W extends java.lang.Number>
+Class that implements the Dijkstra algorithm and uses it for getting all the distance from a source
+ |
+
class |
+Tarjan<V,W extends java.lang.Number>
+Class that implements the Tarjan algorithm and uses it for getting the SCC and the topological sort
+ |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph.visit.impl | ++ |
| Modifier and Type | +Class and Description | +
|---|---|
class |
+Tarjan<V,W extends java.lang.Number>
+Class that implements the Tarjan algorithm and uses it for getting the SCC and the topological sort
+ |
+
V - the vertex of the graphW - the weight of the graphpublic class BFS<V,W extends java.lang.Number> +extends java.lang.Object +implements VisitStrategy<V,W>+
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+With this the graph will be visited accordingly to the strategy of the visit.
++ Some strategy can accept a source vertex null, because they visit all the graph anyway. + If you want to stop the visit of the graph, you just have to throw any exception in the visit function, but be sure to catch it |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic VisitInfo<V> visit(Graph<V,W> graph, + V source, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
VisitStrategyvisit in interface VisitStrategy<V,W extends java.lang.Number>graph - the graph to visitsource - the source of the visitvisit - the function to apply at each vertex when they are visitedjava.lang.NullPointerException - if one of the arguments is null (only the consumers can be null)java.lang.IllegalArgumentException - if the source vertex is not in the graphV - the vertex of the graphW - the weight of the graphpublic class DFS<V,W extends java.lang.Number> +extends java.lang.Object +implements VisitStrategy<V,W>+
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+With this the graph will be visited accordingly to the strategy of the visit.
++ Some strategy can accept a source vertex null, because they visit all the graph anyway. + If you want to stop the visit of the graph, you just have to throw any exception in the visit function, but be sure to catch it |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic VisitInfo<V> visit(Graph<V,W> graph, + V source, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
VisitStrategyvisit in interface VisitStrategy<V,W extends java.lang.Number>graph - the graph to visitsource - the source of the visitvisit - the function to apply at each vertex when they are visitedjava.lang.NullPointerException - if one of the arguments is null (only the consumers can be null)java.lang.IllegalArgumentException - if the source vertex is not in the graphV - vertexW - weightpublic class Dijkstra<V,W extends java.lang.Number> +extends java.lang.Object +implements VisitDistance<V,W>+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.Map<V,java.util.List<Edge<V,W>>> |
+getLastDistance()
+Get the last calculated distance to all the possible destinations
++ The map contains all the possible vertices that are reachable from the source set in the visit + If there is no path between the destination and the source, then null is returned as accordingly to the map interface + If the visit is not already been done, then the map is null. |
+
V |
+getLastSource()
+Get the last source vertex of the visit for calculating the destinations.
++ Returns null if the visit is not already been done |
+
VisitInfo<V> |
+visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+With this the graph will be visited accordingly to the strategy of the visit.
++ Some strategy can accept a source vertex null, because they visit all the graph anyway. + If you want to stop the visit of the graph, you just have to throw any exception in the visit function, but be sure to catch it |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic java.util.Map<V,java.util.List<Edge<V,W>>> getLastDistance()+
VisitDistancegetLastDistance in interface VisitDistance<V,W extends java.lang.Number>public V getLastSource()+
VisitDistancegetLastSource in interface VisitDistance<V,W extends java.lang.Number>public VisitInfo<V> visit(Graph<V,W> graph, + V source, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
VisitStrategyvisit in interface VisitStrategy<V,W extends java.lang.Number>graph - the graph to visitsource - the source of the visitvisit - the function to apply at each vertex when they are visitedjava.lang.NullPointerException - if one of the arguments is null (only the consumers can be null)java.lang.IllegalArgumentException - if the source vertex is not in the graphV - vertexW - weightpublic class Tarjan<V,W extends java.lang.Number> +extends java.lang.Object +implements VisitSCC<V,W>, VisitTopological<V,W>+
| Modifier and Type | +Method and Description | +
|---|---|
java.util.Collection<java.util.Collection<V>> |
+getSCC()
+Return the latest calculated strongly connected components of the graph.
+ |
+
java.util.List<V> |
+getTopologicalSort()
+Return the latest calculated Topological sort of the graph.
++ If the latest visited graph is not a DAG, it will return null. |
+
VisitInfo<V> |
+visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+This particular visit strategy use only the graph and the visit, so the source param is not needed.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic java.util.Collection<java.util.Collection<V>> getSCC()+
VisitSCCpublic java.util.List<V> getTopologicalSort()+
VisitTopologicalgetTopologicalSort in interface VisitTopological<V,W extends java.lang.Number>public VisitInfo<V> visit(Graph<V,W> graph, + V source, + java.util.function.Consumer<V> visit) + throws java.lang.NullPointerException, + java.lang.IllegalArgumentException+
visit in interface VisitStrategy<V,W extends java.lang.Number>graph - the graph to visitsource - not neededvisit - the function to apply at each vertex when they are visitedjava.lang.NullPointerException - if the graph is nulljava.lang.IllegalArgumentException - doesn't throw thispublic class VisitInfo.VertexInfo +extends java.lang.Object +implements java.lang.Comparable<VisitInfo.VertexInfo>+
| Modifier and Type | +Field and Description | +
|---|---|
V |
+parent |
+
long |
+timeDiscovered |
+
long |
+timeVisited |
+
V |
+vertex |
+
| Modifier and Type | +Method and Description | +
|---|---|
int |
+compareTo(VisitInfo.VertexInfo other) |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic final V vertex+
public final V parent+
public final long timeDiscovered+
public final long timeVisited+
public int compareTo(VisitInfo.VertexInfo other)+
compareTo in interface java.lang.Comparable<VisitInfo.VertexInfo>public java.lang.String toString()+
toString in class java.lang.ObjectV - the vertex of the visitpublic class VisitInfo<V>
+extends java.lang.Object
+| Modifier and Type | +Class and Description | +
|---|---|
class |
+VisitInfo.VertexInfo
+Class used mainly for storing the data of the visit
+ |
+
| Constructor and Description | +
|---|
VisitInfo(V source)
+Need a source for initialize the basic values
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+forEach(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
+Iterate through all the vertices discovered and visited with the correct timeline.
++ The vertices will be visited in the order that they are discovered and visited, so a vertex can appear two times (one for the discovery, anc the other for the visit) |
+
void |
+forEachDiscovered(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
+Iterate through all the vertices that are discovered.
++ The vertices will be ordered by the time of their discover. |
+
void |
+forEachVisited(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
+Iterate through all the vertices that are visited.
++ The vertices will be ordered by the time of their visit. |
+
java.util.Set<V> |
+getDiscovered()
+Get all the discovered vertices so far.
+ |
+
V |
+getParentOf(V vertex)
+Get the parent of a particular vertex.
++ The parent of a vertex is the one that has discovered it + If the vertex has no parent (it has not been set by the visit algorithm or it's the source) then null is returned. |
+
V |
+getSource()
+Get the source of the visit.
+ |
+
long |
+getTimeDiscover(V vertex)
+The time of the vertex when it is discovered in the visit.
++ For "discovered" i mean when the node is first found by the visit algorithm. |
+
long |
+getTimeVisit(V vertex)
+The time when the vertex is visited by the algorithm
++ For "visited" i mean when the node is finally visited by the visit algorithm. |
+
java.util.Set<V> |
+getVisited()
+Get all the visited vertices so far.
+ |
+
boolean |
+isDiscovered(V vertex)
+Tells if a vertex is discovered or not
+ |
+
boolean |
+isVisited(V vertex)
+Tells if the vertex is visited or not
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic VisitInfo(V source)+
source - the source of the visitjava.lang.NullPointerException - if the source is nullpublic long getTimeDiscover(V vertex) + throws java.lang.IllegalArgumentException, + java.lang.NullPointerException+
VisitStrategyvertex - the vertex neededjava.lang.IllegalArgumentException - if the vertex is not discoveredjava.lang.NullPointerException - if the vertex is nullpublic long getTimeVisit(V vertex) + throws java.lang.IllegalArgumentException, + java.lang.NullPointerException+
VisitStrategyvertex - the vertex neededjava.lang.IllegalArgumentException - if the vertex is not visitedjava.lang.NullPointerException - if the vertex is nullpublic boolean isDiscovered(V vertex) + throws java.lang.NullPointerException+
vertex - the vertex chosenjava.lang.NullPointerExceptionpublic boolean isVisited(V vertex) + throws java.lang.NullPointerException+
vertex - the vertex chosenjava.lang.NullPointerExceptionpublic V getSource()+
public V getParentOf(V vertex) + throws java.lang.IllegalArgumentException+
vertex - the child vertexjava.lang.IllegalArgumentException - if the vertex has not been discovered yetpublic java.util.Set<V> getVisited()+
public java.util.Set<V> getDiscovered()+
public void forEachDiscovered(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)+
consumer - the function to apply to eachpublic void forEachVisited(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)+
consumer - the function to apply to eachpublic void forEach(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)+
consumer - the function to apply at each vertex| Package | +Description | +
|---|---|
| berack96.lib.graph.visit.impl | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
int |
+VisitInfo.VertexInfo.compareTo(VisitInfo.VertexInfo other) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+VisitInfo.forEach(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
+Iterate through all the vertices discovered and visited with the correct timeline.
++ The vertices will be visited in the order that they are discovered and visited, so a vertex can appear two times (one for the discovery, anc the other for the visit) |
+
void |
+VisitInfo.forEachDiscovered(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
+Iterate through all the vertices that are discovered.
++ The vertices will be ordered by the time of their discover. |
+
void |
+VisitInfo.forEachVisited(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
+Iterate through all the vertices that are visited.
++ The vertices will be ordered by the time of their visit. |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.visit | ++ |
| berack96.lib.graph.visit.impl | ++ |
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+Vertex.visit(VisitStrategy strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph from this current vertex with the strategy assigned
+ |
+
VisitInfo<V> |
+Graph.visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit)
+Visit the graph accordingly to the strategy that is passed.
++ This method visit the graph from the source to all the vertex that are reachable form the source. + Some strategy can accept a source vertex null, because they visit all the graph anyway. |
+
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+MatrixGraph.visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit) |
+
VisitInfo<V> |
+MapGraph.visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit) |
+
VisitInfo<V> |
+AdjGraph.visit(V source,
+ VisitStrategy<V,W> strategy,
+ java.util.function.Consumer<V> visit) |
+
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+VisitStrategy.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+With this the graph will be visited accordingly to the strategy of the visit.
++ Some strategy can accept a source vertex null, because they visit all the graph anyway. + If you want to stop the visit of the graph, you just have to throw any exception in the visit function, but be sure to catch it |
+
| Modifier and Type | +Method and Description | +
|---|---|
VisitInfo<V> |
+Tarjan.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit)
+This particular visit strategy use only the graph and the visit, so the source param is not needed.
+ |
+
VisitInfo<V> |
+Dijkstra.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit) |
+
VisitInfo<V> |
+DFS.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit) |
+
VisitInfo<V> |
+BFS.visit(Graph<V,W> graph,
+ V source,
+ java.util.function.Consumer<V> visit) |
+
| Class | +Description | +
|---|---|
| BFS<V,W extends java.lang.Number> | +
+ Breadth-first search
++ The algorithm starts at the root node and explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level. |
+
| DFS<V,W extends java.lang.Number> | +
+ Depth-first search
++ The algorithm starts at the root node and explores as far as possible along each branch before backtracking. |
+
| Dijkstra<V,W extends java.lang.Number> | +
+ Class that implements the Dijkstra algorithm and uses it for getting all the distance from a source
+ |
+
| Tarjan<V,W extends java.lang.Number> | +
+ Class that implements the Tarjan algorithm and uses it for getting the SCC and the topological sort
+ |
+
| VisitInfo<V> | +
+ The class used for getting the info of the visit.
++ It could be used with the algorithm of the visit for set some useful data. |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.visit | ++ |
| berack96.lib.graph.visit.impl | ++ |
| Class and Description | +
|---|
| VisitInfo
+ The class used for getting the info of the visit.
++ It could be used with the algorithm of the visit for set some useful data. |
+
| Class and Description | +
|---|
| VisitInfo
+ The class used for getting the info of the visit.
++ It could be used with the algorithm of the visit for set some useful data. |
+
| Class and Description | +
|---|
| VisitInfo
+ The class used for getting the info of the visit.
++ It could be used with the algorithm of the visit for set some useful data. |
+
| Class and Description | +
|---|
| VisitInfo
+ The class used for getting the info of the visit.
++ It could be used with the algorithm of the visit for set some useful data. |
+
| VisitInfo.VertexInfo
+ Class used mainly for storing the data of the visit
+ |
+
| Interface | +Description | +
|---|---|
| VisitDistance<V,W extends java.lang.Number> | +
+ Interface that is helpful for implements visit that needs to retrieve the distance between a vertex to all the others
+ |
+
| VisitDistSourceDest<V,W extends java.lang.Number> | +
+ Interface that is helpful for implements visit that needs to retrieve the distance between a vertex to all the others
+ |
+
| VisitSCC<V,W extends java.lang.Number> | +
+ Interface that is helpful for implements visit that needs to retrieve the SCC
+ |
+
| VisitStrategy<V,W extends java.lang.Number> | +
+ This class is used for define some strategy for the visit of a graph.
+ |
+
| VisitTopological<V,W extends java.lang.Number> | +
+ Interface that is helpful for implements visit that needs to retrieve the topological sort
+ |
+
| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.visit | ++ |
| berack96.lib.graph.visit.impl | ++ |
| Class and Description | +
|---|
| VisitStrategy
+ This class is used for define some strategy for the visit of a graph.
+ |
+
| Class and Description | +
|---|
| VisitStrategy
+ This class is used for define some strategy for the visit of a graph.
+ |
+
| Class and Description | +
|---|
| VisitStrategy
+ This class is used for define some strategy for the visit of a graph.
+ |
+
| Class and Description | +
|---|
| VisitStrategy
+ This class is used for define some strategy for the visit of a graph.
+ |
+
| Class and Description | +
|---|
| VisitDistance
+ Interface that is helpful for implements visit that needs to retrieve the distance between a vertex to all the others
+ |
+
| VisitSCC
+ Interface that is helpful for implements visit that needs to retrieve the SCC
+ |
+
| VisitStrategy
+ This class is used for define some strategy for the visit of a graph.
+ |
+
| VisitTopological
+ Interface that is helpful for implements visit that needs to retrieve the topological sort
+ |
+
| Modifier and Type | +Constant Field | +Value | +
|---|---|---|
+
+public static final java.lang.String |
+NOT_CONNECTED |
+"The source vertex doesn\'t have a path that reach the destination" |
+
+
+public static final java.lang.String |
+NOT_DAG |
+"The graph is not a DAG" |
+
+
+public static final java.lang.String |
+PARAM_NULL |
+"The parameter must not be null" |
+
+
+public static final java.lang.String |
+VERTEX_NOT_CONTAINED |
+"The vertex must be contained in the graph" |
+
| Modifier and Type | +Constant Field | +Value | +
|---|---|---|
+
+public static final java.lang.String |
+REMOVED |
+"The vertex is no longer in the graph" |
+
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Graph.contains(Object) returns true.Graph.getMarks(Object) applied to any vertex will return an empty setGraph.getChildren(Object)Vertex.getAncestors(), but as Vertex.Vertex.getChildren(), but as Vertex.Vertex+ + diff --git a/doc/overview-summary.html b/doc/overview-summary.html new file mode 100644 index 0000000..16513f3 --- /dev/null +++ b/doc/overview-summary.html @@ -0,0 +1,167 @@ + + + + + +
| Package | +Description | +
|---|---|
| berack96.lib.graph | ++ |
| berack96.lib.graph.impl | ++ |
| berack96.lib.graph.models | ++ |
| berack96.lib.graph.view | ++ |
| berack96.lib.graph.view.edge | ++ |
| berack96.lib.graph.view.stuff | ++ |
| berack96.lib.graph.view.vertex | ++ |
| berack96.lib.graph.visit | ++ |
| berack96.lib.graph.visit.impl | ++ |
java.util.Map<K,V> visits+
GraphicalView<O> vertexRender+
GraphicalView<O> edgeRender+
java.lang.Class<T> classV+
java.lang.Class<T> classW+
java.awt.Container vertices+
java.awt.Container edges+
Graph<V,W extends java.lang.Number> graph+
java.util.Set<E> observers+
GraphListener old+
VertexComponent<V> source+
VertexComponent<V> destination+
java.lang.Number weight+
Edge<V,W extends java.lang.Number> edge+