public class BidirectionalGraph extends Graph
Modifier and Type | Field and Description |
---|---|
int |
diameter
Diameter gives the distance of the most distant vertices connected by the
shortest path possible.
|
int |
edgesCount
Gives the number of edges in the graph.
|
Constructor and Description |
---|
BidirectionalGraph()
Standard constructor
|
BidirectionalGraph(double[][] _internalLinks)
This constructor allows to instantiate an already constructed graph from
internal links of an Module.
|
BidirectionalGraph(java.util.HashMap<java.lang.Integer,java.util.TreeSet<java.lang.Integer>> localpart)
This constructor allows to instantiate an already constructed graph in a
HashMap
|
BidirectionalGraph(Module module)
This constructor allows to instantiate an already constructed graph from
internal links of an Module.
|
Modifier and Type | Method and Description |
---|---|
void |
addDirectedLink(java.lang.Integer nodeA,
java.lang.Integer nodeB)
Adds a directed Link from nodeA to nodeB.
|
void |
addNode(java.lang.Integer node)
Adds a node to the graph
|
void |
addNodes(java.util.TreeSet<java.lang.Integer> nodes)
Adds a aet of nodes to the graph.
|
boolean |
areConnected(java.lang.Integer verticeA,
java.lang.Integer verticeB)
Checks wheather two vertices are connected.
|
boolean |
areNeighbours(java.lang.Integer a,
java.lang.Integer b)
Check if a and b are neighbours/directly connected a---b
|
void |
connect(java.lang.Integer nodeA,
java.lang.Integer nodeB)
Connects two vertices in a graph in both directions from nodeA to nodeB and
from nodeB to nodeA (bidirectional)
|
void |
connectedToClique(java.lang.Integer candidate,
java.util.TreeSet<java.lang.Integer> clique)
Connects a node to a node set
|
BidirectionalGraph |
copy(java.util.TreeSet<java.lang.Integer> name) |
BidirectionalGraph |
createLocalNetworkPart(java.lang.Integer siteA,
java.lang.Integer siteB)
Creates a local part of a this graph.
|
java.util.Vector<java.util.TreeSet<java.lang.Integer>> |
detectIndependentSets() |
void |
disconnect(java.lang.Integer node)
Disconnects a vertice from a bidirectional graph in both directions
|
void |
disconnect(java.lang.Integer nodeA,
java.lang.Integer nodeB)
Disconnects two vertices in a bidirectional graph in both directions from i
to j and from j to i (bidirectional)
|
boolean |
existsNode(int j) |
java.util.HashMap<java.lang.Integer,java.lang.Integer> |
getCliqueDistribution()
Returns the HashMap which holds the clique distribution.
|
java.util.TreeSet<java.lang.Integer> |
getCommonNeighbours(java.lang.Integer a,
java.lang.Integer b)
Gets common neighbours between two vertices.
|
java.util.TreeSet<java.lang.Integer> |
getCommonNeighbours(java.util.TreeSet<java.lang.Integer> Vertices,
java.lang.Integer can)
Gets common neighbours between a pool of vertices and an additional
vertice.
|
java.util.TreeSet<java.lang.String> |
getConnections() |
java.lang.Integer |
getCoordinationNumber(java.lang.Integer vertice)
Gets the coordination number.
|
int[] |
getDistribution()
Returns the clique distribution used to construct the graph
|
java.util.TreeSet<java.lang.Integer> |
getLinksOfNode(java.lang.Integer vertice)
Get all connections of a vertice to neighbours as a TreeSet
|
java.util.HashMap<java.lang.Integer,java.util.TreeSet<java.lang.Integer>> |
getNetworkTreeSet()
Get the network as a TreeSet
|
boolean |
getNodeExists(java.lang.Integer integer)
Check wheather that node exists in the graph
|
int |
getNodesCount()
Returns the number of nodes in this graph.
|
java.lang.Integer |
getNodeWithLowestDegree() |
java.util.TreeSet<java.lang.Integer> |
getSetOfNodes()
Get all nodes of this graph as a TreeSet
|
boolean |
haveOneCommonNeighbour(java.lang.Integer a,
java.lang.Integer b)
Check if a and b have one common neighbour/indirectly connected over one
site a-x-b.
|
boolean |
isConnectedTo(java.util.TreeSet<java.lang.Integer> clique,
java.lang.Integer candidate)
Checks wheather a vertice is fully connecte to a set of vertices
|
boolean |
isHasIdependentSets() |
boolean |
isZeroNode(java.lang.String path) |
void |
load(java.lang.String path,
int edgecountlimit,
int nodecountlimit)
loads a graph of the format node white space node
|
void |
loadBipartite(java.lang.String path,
int edgecountlimit,
int nodecountlimit,
boolean integrate) |
BidirectionalGraph |
loadPajek(java.lang.String path) |
void |
merge(java.lang.Integer toMerge,
java.lang.Integer toBeMerged)
merges two sites after the checking algorithm assured this operation does
not violate the clique distribution.
|
void |
printCliquesSummary()
Prints a clique summary to the standard output.
|
void |
printNetwork()
Prints the network to the standard output
|
void |
removeNode(java.lang.Integer node)
Removes a node from the graph and all connections attached to it.
|
void |
save(java.lang.String path) |
void |
savePajek(java.lang.String path) |
void |
setConnections(java.util.TreeSet<java.lang.String> connections) |
void |
setNetworkTreeSet(java.util.HashMap<java.lang.Integer,java.util.TreeSet<java.lang.Integer>> _networkTreeSet)
sets a network
|
java.lang.Integer |
totalCoordinationNumer(java.util.TreeSet<java.lang.Integer> partOfNetwork)
Counts all coordination numbers of the network.
|
public int diameter
public int edgesCount
public BidirectionalGraph()
public BidirectionalGraph(java.util.HashMap<java.lang.Integer,java.util.TreeSet<java.lang.Integer>> localpart)
localpart
- public BidirectionalGraph(double[][] _internalLinks)
_internalLinks
- - internal links of an Modulepublic BidirectionalGraph(Module module)
module
- public void addNode(java.lang.Integer node)
public void removeNode(java.lang.Integer node)
node
- public void addNodes(java.util.TreeSet<java.lang.Integer> nodes)
nodes
- a set of nodespublic void addDirectedLink(java.lang.Integer nodeA, java.lang.Integer nodeB)
nodeA
- node to connect fromnodeB
- node to connect topublic java.util.TreeSet<java.lang.Integer> getCommonNeighbours(java.util.TreeSet<java.lang.Integer> Vertices, java.lang.Integer can)
Vertices
- - a set of verticescan
- - a verticepublic void printCliquesSummary()
public java.lang.Integer totalCoordinationNumer(java.util.TreeSet<java.lang.Integer> partOfNetwork)
public void connect(java.lang.Integer nodeA, java.lang.Integer nodeB)
public void disconnect(java.lang.Integer nodeA, java.lang.Integer nodeB)
disconnect
in class Graph
nodeA
- - vertice to be disconnected from jnodeB
- - vertice to be disconnected from ipublic void disconnect(java.lang.Integer node)
node
- - vertice to be disconnected from graphpublic void connectedToClique(java.lang.Integer candidate, java.util.TreeSet<java.lang.Integer> clique)
clique
- a node setcandidate
- a vertice to be connected to the noe setpublic void printNetwork()
public void merge(java.lang.Integer toMerge, java.lang.Integer toBeMerged)
toMerge
- a candidate to mergetoBeMerged
- a candidate to mergepublic boolean areNeighbours(java.lang.Integer a, java.lang.Integer b)
a
- a candidate to mergeb
- a candidate to mergepublic boolean haveOneCommonNeighbour(java.lang.Integer a, java.lang.Integer b)
a
- a candidate to mergeb
- a candidate to mergepublic java.util.TreeSet<java.lang.Integer> getCommonNeighbours(java.lang.Integer a, java.lang.Integer b)
a
- - a set of verticesb
- - a verticepublic boolean isConnectedTo(java.util.TreeSet<java.lang.Integer> clique, java.lang.Integer candidate)
clique
- A set of vertices which define a cliquecandidate
- A vertice which is to check wheather it is fully connected
to the cliquepublic java.lang.Integer getCoordinationNumber(java.lang.Integer vertice)
vertice
- - a vertice to gets its coordination number.public java.util.HashMap<java.lang.Integer,java.util.TreeSet<java.lang.Integer>> getNetworkTreeSet()
public void setNetworkTreeSet(java.util.HashMap<java.lang.Integer,java.util.TreeSet<java.lang.Integer>> _networkTreeSet)
_networkTreeSet
- public BidirectionalGraph createLocalNetworkPart(java.lang.Integer siteA, java.lang.Integer siteB)
siteA
- siteB
- public boolean areConnected(java.lang.Integer verticeA, java.lang.Integer verticeB)
verticeA
- verticeB
- public java.util.HashMap<java.lang.Integer,java.lang.Integer> getCliqueDistribution()
public int[] getDistribution()
public java.util.TreeSet<java.lang.Integer> getSetOfNodes()
public java.util.TreeSet<java.lang.Integer> getLinksOfNode(java.lang.Integer vertice)
vertice
- public boolean getNodeExists(java.lang.Integer integer)
integer
- public int getNodesCount()
public java.util.TreeSet<java.lang.String> getConnections()
public void setConnections(java.util.TreeSet<java.lang.String> connections)
public BidirectionalGraph loadPajek(java.lang.String path)
public void savePajek(java.lang.String path)
public void load(java.lang.String path, int edgecountlimit, int nodecountlimit)
path
- edgecountlimit
- nodecountlimit
- public boolean isZeroNode(java.lang.String path)
public java.lang.Integer getNodeWithLowestDegree()
public void loadBipartite(java.lang.String path, int edgecountlimit, int nodecountlimit, boolean integrate)
public boolean existsNode(int j)
public BidirectionalGraph copy(java.util.TreeSet<java.lang.Integer> name)
public java.util.Vector<java.util.TreeSet<java.lang.Integer>> detectIndependentSets()
public boolean isHasIdependentSets()