|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object peersim.graph.SubGraphEdges
public class SubGraphEdges
This class is an adaptor for representing subgraphs of any graph. The subgraph is defined the following way. The subgraph always contains all the nodes of the original underlying graph. However, it is possible to remove edges by flagging nodes as removed, in which case the edges that have at least one end on those nodes are removed. If the underlying graph changes after initialization, this class follows the change.
Constructor Summary | |
---|---|
SubGraphEdges(Graph g)
Constructs an initially empty subgraph of g. |
Method Summary | |
---|---|
boolean |
addNode(int i)
Adds given node to subgraph. |
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)
If both i and j are within the node set of the subgraph and the original graph has an (i,j) edge, returns that edge. |
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 |
removeNode(int i)
Removes given node from subgraph. |
boolean |
setEdge(int i,
int j)
not supported |
int |
size()
The number of nodes in the graph. |
int |
subGraphSize()
This function returns the size of the subgraph, i.e. the number of nodes in the subgraph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SubGraphEdges(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 subGraphSize()
public boolean removeNode(int i)
public boolean addNode(int i)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |