|
JavaGenes, NASA Ames. Written largely by Al Globus | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nasa.javaGenes.core.Evolvable
gov.nasa.javaGenes.graph.Graph
A information theoretic graph, in other words, a set of vertices and a set of edges. Each edge connects two vertices. This implementation supports genetic software with a crossover operator and a distance function that uses all-pairs-shortest-path.
Vertice
,
Edge
,
apsp
,
Serialized FormNested Class Summary | |
protected static class |
Graph.TrailKey
An object that efficiently represents a path for use in as a key Hashtables and KeyCounters. |
Field Summary | |
protected ExtendedVector |
edges
|
protected KeyCounter |
nodeTypePairsShortestTrailCounts
cache the results of all-pairs-shortest-path since this operation is compute intensive. |
protected ExtendedVector |
vertices
|
Fields inherited from class gov.nasa.javaGenes.core.Evolvable |
childMakersUsed |
Constructor Summary | |
Graph()
|
|
Graph(VertexAndEdgeProvider provider,
int numberOfVertices,
int numberOfCycles)
Generates a random graph. |
Method Summary | |
void |
add(Edge e)
|
void |
add(Graph g)
add actual (not copies) vertices and edges of g to this. |
void |
add(Vertex v)
|
boolean |
canMate(Graph graph)
can I perform crossover with graph? |
protected void |
changed()
Must be called when the graph changes. |
java.lang.Object |
clone()
copy the graph and make copies of all edges and vertices |
Graph |
deepCopyGraph()
copy the graph and make copies of all edges and vertices |
void |
delete(Edge e)
Removes Edge e from graph, removes the vertices from e, and removes e from its vertices. |
double |
distanceFrom(Evolvable other)
Subclasses will almost always override this. |
void |
executeOnEdges(Procedure p)
|
void |
executeOnVertices(Procedure p)
Execute Procedure p on all vertices |
Graph |
getConnectedSubgraph(Vertex v)
Walks the graph starting at Vertex v adding copies of all edges and vertices to the new graph. |
int[][] |
getConnectionTable()
|
Edge |
getEdge(int i)
|
EdgeIterator |
getEdgeIterator()
|
int |
getEdgesSize()
|
Edge |
getEquivalent(Graph graph,
Edge edge)
|
Vertex |
getEquivalent(Graph graph,
Vertex vertex)
|
KeyCounter |
getExtendedVertexTypesCounter()
|
KeyCounter |
getNodeTypePairsShortestTrailCounts()
|
int |
getNumberOfCycles()
|
Edge |
getRandomEdge()
|
Edge |
getRandomEdge(Predicate p)
|
Vertex |
getRandomVertex()
|
Vertex |
getRandomVertex(Predicate p)
|
int |
getSize()
|
java.lang.String |
getStringKey(Vertex v1,
Vertex v2,
int count)
Represents a path with a string. |
Trail |
getTrailBetween(Vertex v1,
Vertex v2)
|
Vertex |
getVertex(int i)
|
VertexAndTrailIterator |
getVertexAndTrailIterator(Vertex v)
|
VertexIterator |
getVertexIterator()
|
int |
getVerticesSize()
|
boolean |
hasVertexPairCloserThan(double distance)
|
boolean |
isConnected()
|
boolean |
isLegal()
|
void |
numberVertices(int start)
Number the vertices starting with int start. |
void |
numberVerticesReverse(int start)
|
void |
remove(Edge e)
Removes Edge e from graph. |
void |
remove(Vertex v)
Removes Vertex v from graph. |
void |
removeLastNVertices(int n)
|
void |
replaceEdge(Edge oldEdge,
Edge newEdge)
|
void |
replaceVertex(Vertex oldVertex,
Vertex newVertex)
|
void |
setAllMarks(boolean m)
set marks on all edges and vertices |
void |
setEdgeMarks(boolean m)
|
void |
setVertexMarks(boolean m)
|
java.lang.Object |
shallowClone()
copy the graph and don't make copies of all edges and vertices |
java.lang.String |
toString()
|
Methods inherited from class gov.nasa.javaGenes.core.Evolvable |
addChildMakers, copyForEvolution, getChildMakersUsed, getSmallest, prepareForEvaluator, stateSave |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected ExtendedVector vertices
protected ExtendedVector edges
protected KeyCounter nodeTypePairsShortestTrailCounts
Constructor Detail |
public Graph()
public Graph(VertexAndEdgeProvider provider, int numberOfVertices, int numberOfCycles)
provider
- will provide random edges and vertices for the graphMethod Detail |
public Graph deepCopyGraph()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
public java.lang.Object shallowClone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
public java.lang.String toString()
public boolean hasVertexPairCloserThan(double distance)
public Graph getConnectedSubgraph(Vertex v)
Mark
public Trail getTrailBetween(Vertex v1, Vertex v2)
public VertexAndTrailIterator getVertexAndTrailIterator(Vertex v)
public double distanceFrom(Evolvable other)
Evolvable
distanceFrom
in class Evolvable
public KeyCounter getNodeTypePairsShortestTrailCounts()
public KeyCounter getExtendedVertexTypesCounter()
public int[][] getConnectionTable()
apsp
public java.lang.String getStringKey(Vertex v1, Vertex v2, int count)
public boolean isConnected()
public boolean canMate(Graph graph)
protected void changed()
public void setAllMarks(boolean m)
Mark
public void add(Graph g)
public int getSize()
getSize
in class Evolvable
public int getNumberOfCycles()
public int getVerticesSize()
public void add(Edge e)
public void remove(Edge e)
delete(gov.nasa.javaGenes.graph.Edge)
public void setEdgeMarks(boolean m)
Mark
public EdgeIterator getEdgeIterator()
public Edge getRandomEdge()
public Edge getRandomEdge(Predicate p)
public Edge getEdge(int i)
public void executeOnEdges(Procedure p)
public Edge getEquivalent(Graph graph, Edge edge)
public void delete(Edge e)
Edge.removeVertices()
public void replaceEdge(Edge oldEdge, Edge newEdge)
public void replaceVertex(Vertex oldVertex, Vertex newVertex)
public int getEdgesSize()
public void add(Vertex v)
public void remove(Vertex v)
public void removeLastNVertices(int n)
public void setVertexMarks(boolean m)
Mark
public VertexIterator getVertexIterator()
public Vertex getRandomVertex()
public Vertex getRandomVertex(Predicate p)
public Vertex getVertex(int i)
public void executeOnVertices(Procedure p)
public Vertex getEquivalent(Graph graph, Vertex vertex)
public void numberVertices(int start)
Vertex.setNumber(int)
public void numberVerticesReverse(int start)
public boolean isLegal()
|
JavaGenes, NASA Ames. Written largely by Al Globus | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |