pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph Class Reference
[Graph]

Inheritance diagram for pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph:

pygel::Graph::AbstractGraph::AbstractGraph pygel::RandomGraphs::DirectedPowerLawRandomGraph::DirectedPowerLawRandomGraph

List of all members.


Detailed Description

Represents a numbered edge graph.

Numbered edges are required to distinguish multiple edges between same set of vertices. This class also provides an indexed vertex and edge sets. These indices have certain advantages while computing in-degree and out-degree distributions.

Public Member Functions

def __init__
 Constructs a numbered edge graph.
def addEdge
 Adds an edge to a graph.
def deleteEdge
 Delete an edge.
def addVertex
 Adds a vertex.
def deleteVertex
 Deletes a vertex.
def getEdges
 Get all graph edges.
def getVertices
 Get all graph vertices.
def getLastEdgeNumber
 Get the last edge number.
def getOutNeighbors
 Get out-neighbors for a vertex.
def getInNeighbors
 Get in-neighbors for a vertex.
def getNumberOfOutNeighbors
 Get number of out-neighbors for a vertex.
def getNumberOfInNeighbors
 Get number of in-neighbors for a vertex.
def getNumberOfNeighbors
 Get number of neighbors for a vertex.
def getInDegreeDistribution
 Get in-degree distribution.
def getOutDegreeDistribution
 Get out-degree distribution.
def getJointDistribution
 Get joint-degree distribution.
def getDegreeDistribution
 Get degree distribution.
def getVerticesByInDegree
 Gets all the vertices with a particular in-degree.
def getVerticesByOutDegree
 Gets all the vertices with a particular out-degree.
def getSCComponents
 Gets the strongly connected components of a graph.
def getOutComponent
 Gives the out component for a strongly connected component.
def writeCC
 Write the connected components to a file.
def writeEdges
 Write edges to file.
def readEdges
 Read edges from file.
def findEdge
 Find edge with a given edge number.
def findVertex
 Find vertex with a given vertex number.
def hasVertex
 Checks if vertex is present.

Public Attributes

 edgeIndex
 Dictionary of edges, indexed by edge number.
 vertexIndex
 Dictionary of vertices, indexed by vertex number.
 parentIndex
 Dictionary of vertices, indexed by parent.
 parentEdgeIndex
 Dictionary of vertices and edge numbers, indexed by parent.


Member Function Documentation

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::addEdge (   self,
  edge 
)

Adds an edge to a graph.

It also updates the vertex and edge indices.

Parameters:
edge Edge of type BaseElements::Edge to be added to the graph

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::deleteEdge (   self,
  edgeNumber 
)

Delete an edge.

Parameters:
edgeNumber Edge number to be deleted

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::addVertex (   self,
  vertexNumber 
)

Adds a vertex.

Should be used with care

Parameters:
vertexNumber Vertex number of vertex to be added
Exceptions:
PackageExceptions::VertexError 

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::deleteVertex (   self,
  vertexNumber 
)

Deletes a vertex.

Should be used with care

Parameters:
vertexNumber Vertex number to be deleted

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getEdges (   self  ) 

Get all graph edges.

Returns:
edgeIndex Dictionary of edges, indexed by edge number

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getVertices (   self  ) 

Get all graph vertices.

Returns:
vertexIndex Dictionary of vertices, indexed by vertex number

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getLastEdgeNumber (   self  ) 

Get the last edge number.

Returns:
__lastEdgeNumber the last edge number assigned to edges.

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getOutNeighbors (   self,
  vertexNumber 
)

Get out-neighbors for a vertex.

Parameters:
vertexNumber Vertex number for which out-neighbors have to be obtained
Returns:
outNeighbors List of out-neighbors. Each element of type BaseElements::Vertex

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getInNeighbors (   self,
  vertexNumber 
)

Get in-neighbors for a vertex.

Parameters:
vertexNumber Vertex number for which in-neighbors have to be obtained
Returns:
inNeighbors List of in-neighbors. Each element of type BaseElements::Vertex

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getNumberOfOutNeighbors (   self,
  vertexNumber 
)

Get number of out-neighbors for a vertex.

Parameters:
vertexNumber Vertex number for which number of out-neighbors have to be obtained
Returns:
Number of out-neighbors

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getNumberOfInNeighbors (   self,
  vertexNumber 
)

Get number of in-neighbors for a vertex.

Parameters:
vertexNumber Vertex number for which number of in-neighbors have to be obtained
Returns:
Number of in-neighbors

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getNumberOfNeighbors (   self,
  vertexNumber 
)

Get number of neighbors for a vertex.

Parameters:
vertexNumber Vertex number for which number of neighbors have to be obtained
Returns:
Number of neighbors

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getInDegreeDistribution (   self  ) 

Get in-degree distribution.

Returns:
inDegreeDistribution Dictionary indexed on in-degree. Values are the number of nodes for a in-degree

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getOutDegreeDistribution (   self  ) 

Get out-degree distribution.

Returns:
outDegreeDistribution Dictionary indexed on in-degree. Values are the number of nodes for a out-degree

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getJointDistribution (   self  ) 

Get joint-degree distribution.

Returns:
jointDegreeDistribution Dictionary indexed on out-degree and in-degree. Values are the number of nodes for a given combination of out-degree and in-degree

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getDegreeDistribution (   self  ) 

Get degree distribution.

Returns:
degreeDistribution Dictionary indexed on degree. Values are the number of nodes for a degree

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getVerticesByInDegree (   self,
  degree 
)

Gets all the vertices with a particular in-degree.

Parameters:
degree In-degree to look for
Returns:
degreeNodes List of vertices. Each element of type BaseElements::Vertex

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getVerticesByOutDegree (   self,
  degree 
)

Gets all the vertices with a particular out-degree.

Parameters:
degree Out-degree to look for
Returns:
degreeNodes List of vertices. Each element of type BaseElements::Vertex

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getSCComponents (   self,
  getLargest 
)

Gets the strongly connected components of a graph.

It uses Tarjan's strongly connected components algorithm.

Parameters:
getLargest If greater than 0, only returns the largest connected component
Returns:
allSCC List of a List of connected components

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getOutComponent (   self,
  stronglyCC 
)

Gives the out component for a strongly connected component.

Parameters:
stronglyCC Strongly connected component for which th out-component is to be determined
Returns:
outComponent List of vertices in the out component

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::writeCC (   self,
  fileName,
  allSCC 
)

Write the connected components to a file.

Parameters:
fileName File name to store the connected components
allSCC List of list of connected components

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::writeEdges (   self,
  fileName,
  format 
)

Write edges to file.

Parameters:
fileName File name to store edges in
format Format of output file. Can take values:
'simple' = simple format
'dot' = format compatible with 'dot' command

Reimplemented in pygel::RandomGraphs::DirectedPowerLawRandomGraph::DirectedPowerLawRandomGraph.

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::readEdges (   self,
  fileName,
  format 
)

Read edges from file.

Parameters:
fileName File name to read edges from
format Format of input file. Can take values:
'simple' = simple format

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::findEdge (   self,
  edgeNumber 
)

Find edge with a given edge number.

Parameters:
edgeNumber Edge number to look for
Exceptions:
PackageExceptions::EdgeError 
Returns:
Matched edge of type BaseElements::Edge

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::findVertex (   self,
  vertexNumber 
)

Find vertex with a given vertex number.

Parameters:
vertexNumber Vertex number to look for
Exceptions:
PackageExceptions::VertexError 
Returns:
Matched vertex of type BaseElements::Vertex

def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::hasVertex (   self,
  vertexNumber 
)

Checks if vertex is present.

Parameters:
vertexNumber Vertex number of the vertex to check
Returns:
0 if found. 1 if not found


Generated on Sat Dec 13 02:15:46 2008 for Python Webgraph Generator by  doxygen 1.5.6