Commit 4f2b556c authored by haesleinhuepf's avatar haesleinhuepf
Browse files

added public functions to read out special things from the graph (for redmine #2032)

parent 97e0f5bd
......@@ -784,8 +784,39 @@ public class SkeletonAnalyser {
* This function is intended for testing only
* @return List of all vertices
*/
ArrayList<Vertex> getAllVertices()
public ArrayList<Vertex> getAllVertices()
{
return allVertices;
}
public ArrayList<Vertex> getAllConnectedJunctions(Vertex junction)
{
ArrayList<Vertex> result = new ArrayList<Vertex>();
collectAllConnectedJunctions(junction, result);
return result;
}
private void collectAllConnectedJunctions(Vertex junction, ArrayList<Vertex> result)
{
ArrayList<Edge> edges = getEdgesStartingAtJunction(junction);
if (edges.size() > 1) {
result.add(junction);
}
for (Edge edge : edges) {
Vertex v = edge.getV2();
if (!junctionListContainsJunction(result, v)) {
collectAllConnectedJunctions(v, result);
}
}
}
public static boolean junctionListContainsJunction(ArrayList<Vertex> junctions, Vertex junction) {
for (Vertex v : junctions) {
if (junctionsEqual(v, junction)) {
return true;
}
}
return false;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment