Package org.planit.graph
Class ACyclicSubGraph<V extends DirectedVertex,E extends DirectedEdge,ES extends EdgeSegment>
- java.lang.Object
-
- org.planit.graph.ACyclicSubGraph<V,E,ES>
-
- All Implemented Interfaces:
DirectedSubGraph<V,E,ES>
public class ACyclicSubGraph<V extends DirectedVertex,E extends DirectedEdge,ES extends EdgeSegment> extends Object implements DirectedSubGraph<V,E,ES>
An acyclic sub graph contains a subset of the full graph without cycles. The active subset of the graph is tracked by explicitly registering edge segments. Edge segments are by definition directed. Whenever edge segments are added it is verified that no cycles are created. Also each edge segment that is added must connect to the existing subgraph's contents- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description ACyclicSubGraph(IdGroupingToken groupId, DirectedGraph<V,E,ES> parentGraph, V root)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addEdgeSegment(EdgeSegment edgeSegment)
register an edge segment on the subgraphlong
getId()
collect the id of this subgraphDirectedGraph<V,E,ES>
getParentGraph()
the parent graphDirectedVertex
getRootVertex()
collect the root vertex
-
-
-
Constructor Detail
-
ACyclicSubGraph
public ACyclicSubGraph(IdGroupingToken groupId, DirectedGraph<V,E,ES> parentGraph, V root)
Constructor- Parameters:
groupId
- generate id based on the group it resides inparentGraph
- parent Graph we are a subset ofroot
- (initial) root of the subgraph
-
-
Method Detail
-
getId
public long getId()
collect the id of this subgraph- Specified by:
getId
in interfaceDirectedSubGraph<V extends DirectedVertex,E extends DirectedEdge,ES extends EdgeSegment>
- Returns:
- sub graph id
-
getParentGraph
public DirectedGraph<V,E,ES> getParentGraph()
the parent graph- Specified by:
getParentGraph
in interfaceDirectedSubGraph<V extends DirectedVertex,E extends DirectedEdge,ES extends EdgeSegment>
- Returns:
- parent graph
-
getRootVertex
public DirectedVertex getRootVertex()
collect the root vertex- Specified by:
getRootVertex
in interfaceDirectedSubGraph<V extends DirectedVertex,E extends DirectedEdge,ES extends EdgeSegment>
- Returns:
- root vertex
-
addEdgeSegment
public boolean addEdgeSegment(EdgeSegment edgeSegment)
register an edge segment on the subgraph- Specified by:
addEdgeSegment
in interfaceDirectedSubGraph<V extends DirectedVertex,E extends DirectedEdge,ES extends EdgeSegment>
- Parameters:
edgeSegment
- to add- Returns:
- true when successful, false otherwise (for example when the edge segment is not present on the parent graph)
-
-