net.sourceforge.combean.graph.decorators
Class ResidualNetworkGraph

Package class diagram package ResidualNetworkGraph
java.lang.Object
  extended by net.sourceforge.combean.graph.decorators.AbstractDecoratedGraph
      extended by net.sourceforge.combean.graph.decorators.ResidualNetworkGraph
All Implemented Interfaces:
Graph, DirectedEdgeNeighborhoodGraphProp, IncomingEdgeNeighborhoodGraphProp, NeighborhoodGraphProp, NestedGraphProp, OutgoingEdgeNeighborhoodGraphProp

public class ResidualNetworkGraph
extends AbstractDecoratedGraph
implements DirectedEdgeNeighborhoodGraphProp

Decorator which generates the residual graph for a given graph which must have the DirectedEdgeNeighborhoodGraphProp.


Field Summary
static byte INCOMING_RESIDUAL_EDGE
           
static byte OUTGOING_RESIDUAL_EDGE
           
 
Constructor Summary
ResidualNetworkGraph(DirectedEdgeNeighborhoodGraphProp origNeigh)
          Constructor.
 
Method Summary
protected  FixedDoubleEdgeMap getEdgeCapacity()
           
 Class getEdgeClass()
           
protected  FixedDoubleEdgeMap getEdgeFlow()
           
 Node getFirstNode(Edge e)
          Return the first node of an edge.
 EdgeIterator getIncidentEdges(Node v)
          Return an iterator for the local neighborhood of v
 EdgeIterator getIncomingEdges(Node v)
          Get all incoming edges of a given node
 Node getOtherNode(Edge e, Node v)
          Given an edge and an incident node, return the other node of the edge
 EdgeIterator getOutgoingEdges(Node v)
          Get all outgoing edges of a given node
 double getResidualCapacity(Edge e)
          Get the residual capacity for an edge in the residual graph
protected  double getResidualCapacity(Edge origEdge, Node v, byte direction)
          The residual capacity corresponding to an edge in the original graph.
 Node getSecondNode(Edge e)
          Return the second node of an edge.
 DirectedEdgeNeighborhoodGraphProp getUnderlyingGraph()
           
 boolean mayNestGraphProp(Class wantedProp)
          Check whether a property may be provided to the user by the nested graph
 void setEdgeCapacity(FixedDoubleEdgeMap edgeCapacity)
           
 void setEdgeFlow(FixedDoubleEdgeMap edgeFlow)
           
 
Methods inherited from class net.sourceforge.combean.graph.decorators.AbstractDecoratedGraph
getNestedGraph, getNodeClass, isModifiableGraphProp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.combean.interfaces.graph.Graph
getNodeClass
 

Field Detail

INCOMING_RESIDUAL_EDGE

public static final byte INCOMING_RESIDUAL_EDGE
See Also:
Constant Field Values

OUTGOING_RESIDUAL_EDGE

public static final byte OUTGOING_RESIDUAL_EDGE
See Also:
Constant Field Values
Constructor Detail

ResidualNetworkGraph

public ResidualNetworkGraph(DirectedEdgeNeighborhoodGraphProp origNeigh)
Constructor. Generate residual graph for a given graph.

Parameters:
origNeigh - the graph for which the residual graph shall be constructed.
Method Detail

setEdgeCapacity

public final void setEdgeCapacity(FixedDoubleEdgeMap edgeCapacity)
Parameters:
edgeCapacity - The edgeCapacity to set.

setEdgeFlow

public final void setEdgeFlow(FixedDoubleEdgeMap edgeFlow)
Parameters:
edgeFlow - The edgeFlow to set.

getEdgeCapacity

protected final FixedDoubleEdgeMap getEdgeCapacity()
Returns:
Returns the edgeCapacity.

getEdgeFlow

protected final FixedDoubleEdgeMap getEdgeFlow()
Returns:
Returns the edgeFlow.

getUnderlyingGraph

public final DirectedEdgeNeighborhoodGraphProp getUnderlyingGraph()
Returns:
Returns the origNeigh.

getResidualCapacity

public final double getResidualCapacity(Edge e)
Get the residual capacity for an edge in the residual graph

Parameters:
e - an edge in the residual graph (must be of type ResidualNetworkEdge)
Returns:
the residual capacity of e

getResidualCapacity

protected double getResidualCapacity(Edge origEdge,
                                     Node v,
                                     byte direction)
The residual capacity corresponding to an edge in the original graph.

Parameters:
origEdge - the edge in the original graph
v - an incident node of the given edge
direction - shall the residual edge be towards or away from v
Returns:
the residual capacity of the edge in the residual network

getOutgoingEdges

public EdgeIterator getOutgoingEdges(Node v)
Description copied from interface: OutgoingEdgeNeighborhoodGraphProp
Get all outgoing edges of a given node

Specified by:
getOutgoingEdges in interface OutgoingEdgeNeighborhoodGraphProp
Returns:
the incoming edges of v

getIncomingEdges

public EdgeIterator getIncomingEdges(Node v)
Description copied from interface: IncomingEdgeNeighborhoodGraphProp
Get all incoming edges of a given node

Specified by:
getIncomingEdges in interface IncomingEdgeNeighborhoodGraphProp
Returns:
the incoming edges of v

getIncidentEdges

public EdgeIterator getIncidentEdges(Node v)
Description copied from interface: NeighborhoodGraphProp
Return an iterator for the local neighborhood of v

Specified by:
getIncidentEdges in interface NeighborhoodGraphProp
Parameters:
v - the node for which the neighborhood shall be given.
Returns:
an iterator through the neighborhood

getFirstNode

public Node getFirstNode(Edge e)
Description copied from interface: NeighborhoodGraphProp
Return the first node of an edge. For directed graphs this is the source of the edge. For undirected graphs the ordering of the nodes of an edge is arbitrary.

Specified by:
getFirstNode in interface NeighborhoodGraphProp
Parameters:
e - the edge
Returns:
the first node of the given edge

getSecondNode

public Node getSecondNode(Edge e)
Description copied from interface: NeighborhoodGraphProp
Return the second node of an edge. For directed graphs this is the target of the edge. For undirected graphs the ordering of the nodes of an edge is arbitrary.

Specified by:
getSecondNode in interface NeighborhoodGraphProp
Parameters:
e - the edge
Returns:
the second node of the given edge

getOtherNode

public Node getOtherNode(Edge e,
                         Node v)
Description copied from interface: NeighborhoodGraphProp
Given an edge and an incident node, return the other node of the edge

Specified by:
getOtherNode in interface NeighborhoodGraphProp
Parameters:
e - the given edge
v - the give node
Returns:
the other incident node of e

mayNestGraphProp

public boolean mayNestGraphProp(Class wantedProp)
Description copied from interface: NestedGraphProp
Check whether a property may be provided to the user by the nested graph

Specified by:
mayNestGraphProp in interface NestedGraphProp
Parameters:
wantedProp - the property which the user wants to use
Returns:
true if the user may access the nested graph for obtaining the wanted property

getEdgeClass

public Class getEdgeClass()
Specified by:
getEdgeClass in interface Graph
Overrides:
getEdgeClass in class AbstractDecoratedGraph