public abstract class EvoSuiteGraph<V,E extends org.jgrapht.graph.DefaultEdge> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Class<E> |
edgeClass |
protected org.jgrapht.DirectedGraph<V,E> |
graph |
protected int |
graphId |
| Modifier | Constructor and Description |
|---|---|
protected |
EvoSuiteGraph(Class<E> edgeClass)
Constructor for EvoSuiteGraph.
|
protected |
EvoSuiteGraph(org.jgrapht.DirectedGraph<V,E> graph,
Class<E> edgeClass)
Constructor for EvoSuiteGraph.
|
| Modifier and Type | Method and Description |
|---|---|
protected E |
addEdge(V src,
V target)
addEdge
|
protected boolean |
addEdge(V src,
V target,
E e)
addEdge
|
protected boolean |
addVertex(V v)
addVertex
|
protected void |
addVertices(Collection<V> vs)
addVertices
|
protected void |
addVertices(EvoSuiteGraph<V,E> other)
addVertices
|
protected org.jgrapht.graph.DefaultDirectedGraph<V,E> |
computeReverseJGraph()
Returns a reverted version of this graph in a jGraph
That is a graph containing exactly the same nodes as this one but for
each edge from v1 to v2 in this graph the resulting graph will contain an
edge from v2 to v1 - or in other words the reverted edge
This is used to revert CFGs in order to determine control dependencies
for example
|
boolean |
containsEdge(E e)
containsEdge
|
boolean |
containsEdge(V v1,
V v2)
containsEdge
|
boolean |
containsVertex(V v)
containsVertex
|
Set<V> |
determineBranches()
determineBranches
|
Set<V> |
determineConnectedVertices(V v)
Follows all edges adjacent to the given vertex v ignoring edge directions
and returns a set containing all vertices visited that way
|
Set<V> |
determineEntryPoints()
determineEntryPoints
|
Set<V> |
determineExitPoints()
determineExitPoints
|
Set<V> |
determineJoins()
determineJoins
|
protected String |
dotSubFolder()
Subclasses can overwrite this method in order to separate their .dot and
.png export to a special folder.
|
int |
edgeCount()
edgeCount
|
Set<E> |
edgeSet()
edgeSet
|
Set<V> |
getChildren(V node)
getChildren
|
int |
getDistance(V v1,
V v2)
getDistance
|
E |
getEdge(V v1,
V v2)
getEdge
|
V |
getEdgeSource(E e)
getEdgeSource
|
V |
getEdgeTarget(E e)
getEdgeTarget
|
Set<V> |
getIsolatedNodes()
Returns a Set of all nodes within this graph that neither have incoming
nor outgoing edges.
|
String |
getName()
getName
|
Set<V> |
getNodesWithoutChildren()
Returns a Set containing every node in this graph that has no outgoing
edges.
|
Set<V> |
getParents(V node)
getParents
|
V |
getRandomVertex()
getRandomVertex
|
V |
getSingleChild(V node)
If the given node is contained within this graph and has exactly one
child v this method will return v.
|
boolean |
hasNPartentsMChildren(V node,
int n,
int m)
Returns true iff whether the given node is not null, in this graph and
has exactly n parents and m children.
|
Set<E> |
incomingEdgesOf(V node)
incomingEdgesOf
|
int |
inDegreeOf(V node)
inDegreeOf
|
boolean |
isConnected()
Checks whether each vertex inside this graph is reachable from some other
vertex
|
boolean |
isDirectSuccessor(V v1,
V v2)
isDirectSuccessor
|
boolean |
isEmpty()
isEmpty
|
int |
outDegreeOf(V node)
outDegreeOf
|
Set<E> |
outgoingEdgesOf(V node)
outgoingEdgesOf
|
protected boolean |
redirectEdges(V from,
V newStart,
V newEnd)
Redirects all edges going into node from to the node newStart and all
edges going out of node from to the node newEnd.
|
protected boolean |
redirectEdgeSource(E edge,
V node)
Redirects the edge source of the given edge to the given node by removing
the given edge from the graph and reinserting it from the given node to
the original target node
|
protected boolean |
redirectEdgeTarget(E edge,
V node)
Redirects the edge target of the given edge to the given node by removing
the given edge from the graph and reinserting it from the original source
node to the given node
|
protected boolean |
redirectIncomingEdges(V oldNode,
V newNode)
Redirects all incoming edges to oldNode to node newNode by calling
redirectEdgeTarget for each incoming edge of oldNode
|
protected boolean |
redirectOutgoingEdges(V oldNode,
V newNode)
Redirects all outgoing edges to oldNode to node newNode by calling
redirectEdgeSource for each outgoing edge of oldNode
|
void |
registerEdgeAttributeProvider(org.jgrapht.ext.ComponentAttributeProvider<E> edgeAttributeProvider)
registerEdgeAttributeProvider
|
void |
registerVertexAttributeProvider(org.jgrapht.ext.ComponentAttributeProvider<V> vertexAttributeProvider)
registerVertexAttributeProvider
|
void |
toDot()
toDot
|
protected String |
toFileString(String name)
toFileString
|
int |
vertexCount()
vertexCount
|
Set<V> |
vertexSet()
vertexSet
|
protected EvoSuiteGraph(Class<E> edgeClass)
Constructor for EvoSuiteGraph.
V - a V object.E - a E object.edgeClass - a Class object.public V getEdgeSource(E e)
getEdgeSource
e - a E object.public V getEdgeTarget(E e)
getEdgeTarget
e - a E object.public Set<E> outgoingEdgesOf(V node)
outgoingEdgesOf
node - a V object.Set object.public Set<E> incomingEdgesOf(V node)
incomingEdgesOf
node - a V object.Set object.public Set<V> getChildren(V node)
getChildren
node - a V object.Set object.public Set<V> getParents(V node)
getParents
node - a V object.Set object.public V getSingleChild(V node)
node - a V object.protected void addVertices(EvoSuiteGraph<V,E> other)
addVertices
other - a EvoSuiteGraph object.protected void addVertices(Collection<V> vs)
addVertices
vs - a Collection object.protected boolean addVertex(V v)
addVertex
v - a V object.protected E addEdge(V src, V target)
addEdge
src - a V object.target - a V object.protected boolean addEdge(V src, V target, E e)
addEdge
src - a V object.target - a V object.e - a E object.protected boolean redirectEdges(V from, V newStart, V newEnd)
from - a V object.newStart - a V object.newEnd - a V object.protected boolean redirectIncomingEdges(V oldNode, V newNode)
oldNode - a V object.newNode - a V object.protected boolean redirectOutgoingEdges(V oldNode, V newNode)
oldNode - a V object.newNode - a V object.protected boolean redirectEdgeTarget(E edge, V node)
edge - a E object.node - a V object.protected boolean redirectEdgeSource(E edge, V node)
edge - a E object.node - a V object.public int vertexCount()
vertexCount
public int edgeCount()
edgeCount
public int outDegreeOf(V node)
outDegreeOf
node - a V object.public int inDegreeOf(V node)
inDegreeOf
node - a V object.public E getEdge(V v1, V v2)
getEdge
v1 - a V object.v2 - a V object.public boolean containsVertex(V v)
containsVertex
v - a V object.public boolean containsEdge(V v1, V v2)
containsEdge
v1 - a V object.v2 - a V object.public boolean containsEdge(E e)
containsEdge
e - a E object.public boolean isEmpty()
isEmpty
public boolean isConnected()
public Set<V> determineEntryPoints()
determineEntryPoints
public Set<V> determineExitPoints()
determineExitPoints
public Set<V> determineConnectedVertices(V v)
v - a V object.Set object.public boolean hasNPartentsMChildren(V node, int n, int m)
node - a V object.n - a int.m - a int.public Set<V> getIsolatedNodes()
Set object.public Set<V> getNodesWithoutChildren()
Set object.public V getRandomVertex()
getRandomVertex
public int getDistance(V v1, V v2)
getDistance
v1 - a V object.v2 - a V object.public boolean isDirectSuccessor(V v1, V v2)
isDirectSuccessor
v1 - a V object.v2 - a V object.protected org.jgrapht.graph.DefaultDirectedGraph<V,E> computeReverseJGraph()
DefaultDirectedGraph object.public void toDot()
toDot
protected String dotSubFolder()
String object.public void registerVertexAttributeProvider(org.jgrapht.ext.ComponentAttributeProvider<V> vertexAttributeProvider)
registerVertexAttributeProvider
vertexAttributeProvider - a ComponentAttributeProvider object.public void registerEdgeAttributeProvider(org.jgrapht.ext.ComponentAttributeProvider<E> edgeAttributeProvider)
registerEdgeAttributeProvider
edgeAttributeProvider - a ComponentAttributeProvider object.Copyright © 2010–2017 EvoSuite. All rights reserved.