|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeersim.graph.PrefixSubGraph
public class PrefixSubGraph
This class is an adaptor for representing special subgraphs of any graph.
It can represent the subgraphs spanned by the nodes 0,...,i where
i is less than or equal to n-1, the last node of the original graph.
The underlying graph is stored by reference. This means that if the
graph changes, then these changes will be reflected by this class as well.
Besides, the size of the prefix can be changed at will at any time
using setSize(int)
.
Constructor Summary | |
---|---|
PrefixSubGraph(Graph g)
Constructs an initially max size subgraph of g. |
Method Summary | |
---|---|
boolean |
clearEdge(int i,
int j)
not supported |
int |
degree(int i)
Returns the degree of the given node. |
boolean |
directed()
Returns true if the graph is directed otherwise false. |
java.lang.Object |
getEdge(int i,
int j)
Returns the edge in the original graph if both i and j are smaller than size(). |
java.util.Collection<java.lang.Integer> |
getNeighbours(int i)
Returns a collection view to all outgoing edges from i. |
java.lang.Object |
getNode(int i)
Returns the node object associated with the index. |
boolean |
isEdge(int i,
int j)
Returns true if there is a directed edge between node i and node j. |
boolean |
setEdge(int i,
int j)
not supported |
int |
setSize(int i)
Sets the size of the subgraph. |
int |
size()
The number of nodes in the graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PrefixSubGraph(Graph g)
Method Detail |
---|
public boolean isEdge(int i, int j)
Graph
isEdge
in interface Graph
public java.util.Collection<java.lang.Integer> getNeighbours(int i)
Graph
getNeighbours
in interface Graph
public java.lang.Object getNode(int i)
Graph
getNode
in interface Graph
public java.lang.Object getEdge(int i, int j)
getEdge
in interface Graph
public int size()
Graph
size
in interface Graph
public boolean directed()
Graph
directed
in interface Graph
public boolean setEdge(int i, int j)
setEdge
in interface Graph
public boolean clearEdge(int i, int j)
clearEdge
in interface Graph
public int degree(int i)
Graph
degree
in interface Graph
public int setSize(int i)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |