uk.ed.inf.graph.impl
Class SubgraphFactory

java.lang.Object
  extended by uk.ed.inf.graph.impl.SubgraphFactory
All Implemented Interfaces:
IBasicSubgraphFactory<Node,Edge>, IUndirectedSubgraphFactory<Node,Edge>

public final class SubgraphFactory
extends java.lang.Object
implements IUndirectedSubgraphFactory<Node,Edge>


Constructor Summary
SubgraphFactory(Graph graph)
           
 
Method Summary
 void addEdge(Edge edge)
          Add an edge to the factory to be used to compose the subgraph.
 void addNode(Node node)
          Add a node to the factory that will be used to compose the subgraph.
 Subgraph createInducedSubgraph()
          Create an induced subgraph of the nodes and edges added to this factory.
 Subgraph createSubgraph()
          Creates a subgraph, that includes dangling edges.
 java.util.Iterator<Edge> edgeIterator()
          Iterate over the edges that have been added to the factory.
 Graph getGraph()
          The graph that this factory will create a subgraph for.
 java.util.Iterator<Node> nodeIterator()
          Iterate over the nodes that have been added to this factory.
 int numEdges()
          The number of edges added to the factory.
 int numNodes()
          Get the number of nodes added to the factory;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubgraphFactory

SubgraphFactory(Graph graph)
Method Detail

addNode

public void addNode(Node node)
Description copied from interface: IBasicSubgraphFactory
Add a node to the factory that will be used to compose the subgraph.

Specified by:
addNode in interface IBasicSubgraphFactory<Node,Edge>
Parameters:
node - The node to be added. Cannot be null.

addEdge

public void addEdge(Edge edge)
Description copied from interface: IBasicSubgraphFactory
Add an edge to the factory to be used to compose the subgraph.

Specified by:
addEdge in interface IBasicSubgraphFactory<Node,Edge>

createSubgraph

public Subgraph createSubgraph()
Creates a subgraph, that includes dangling edges.

Specified by:
createSubgraph in interface IBasicSubgraphFactory<Node,Edge>
Returns:
the new subgraph, which cannot be null, but can be empty if no nodes and edges were added.

createInducedSubgraph

public Subgraph createInducedSubgraph()
Description copied from interface: IBasicSubgraphFactory
Create an induced subgraph of the nodes and edges added to this factory. This subgraph also contains edges that exist between all the nodes added to the factory, even if they are not explicitly added to the factory.

Specified by:
createInducedSubgraph in interface IBasicSubgraphFactory<Node,Edge>
Returns:
the new subgraph, which cannot be null, but can be empty if no nodes and edges held by the factory.

edgeIterator

public java.util.Iterator<Edge> edgeIterator()
Description copied from interface: IBasicSubgraphFactory
Iterate over the edges that have been added to the factory.

Specified by:
edgeIterator in interface IBasicSubgraphFactory<Node,Edge>
Returns:
the edge iterator that cannot be null.

nodeIterator

public java.util.Iterator<Node> nodeIterator()
Description copied from interface: IBasicSubgraphFactory
Iterate over the nodes that have been added to this factory.

Specified by:
nodeIterator in interface IBasicSubgraphFactory<Node,Edge>
Returns:
the node iterator, which cannot be null.

getGraph

public Graph getGraph()
Description copied from interface: IBasicSubgraphFactory
The graph that this factory will create a subgraph for.

Specified by:
getGraph in interface IBasicSubgraphFactory<Node,Edge>
Returns:
the owning graph, which cannot be null.

numEdges

public int numEdges()
Description copied from interface: IBasicSubgraphFactory
The number of edges added to the factory.

Specified by:
numEdges in interface IBasicSubgraphFactory<Node,Edge>
Returns:
the number of edges.

numNodes

public int numNodes()
Description copied from interface: IBasicSubgraphFactory
Get the number of nodes added to the factory;

Specified by:
numNodes in interface IBasicSubgraphFactory<Node,Edge>
Returns:
the number of nodes.