lu.cs.co.graph
Interface Subgraph

All Known Implementing Classes:
Forest, Path, Marks

public abstract interface Subgraph

Specifies common methods for subgraphs of a graph. A subgraph is a subset of vertices and/or edges of another graph, which is called the underlying graph.


Method Summary
 boolean contains(Edge e)
          Returns true if and only if this subgraph contains a given edge.
 boolean contains(Vertex v)
          Checks if this object contains the argument Vertex (which is supposed to be present in the underlying graph)
 int numEdges()
          Returns the number of edges in this subgraph
 int numVertices()
          Returns the number of vertices in this subgraph
 Graph underlying()
          Returns the underlying graph.
 

Method Detail

underlying

public Graph underlying()
Returns the underlying graph.
Returns:
the underlying graph

contains

public boolean contains(Vertex v)
Checks if this object contains the argument Vertex (which is supposed to be present in the underlying graph)
Parameters:
v - a vertex in the underlying graph
Returns:
true if and only if this object contains the argument vertex

contains

public boolean contains(Edge e)
Returns true if and only if this subgraph contains a given edge. The given edge is supposed to be present in the underlying graph.
Parameters:
e - an edge in the underlying graph
Returns:
true if and only if the given edge is contained in this subgraph

numVertices

public int numVertices()
Returns the number of vertices in this subgraph
Returns:
the number of vertices in this subgraph

numEdges

public int numEdges()
Returns the number of edges in this subgraph
Returns:
the number of edges in this subgraph