pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph Class Reference
[Graph]

Inheritance diagram for pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph:

pygel::Graph::AbstractGraph::AbstractGraph pygel::RandomGraphs::UndirectedPowerLawRandomGraph::UndirectedPowerLawRandomGraph

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 getVertexNumbers
 Get all graph vertex numbers.
def getLastEdgeNumber
 Get the last edge number.
def getNeighbors
 Get neighbors for a vertex.
def getNumberOfNeighbors
 Get number of neighbors for a vertex.
def getDegreeDistribution
 Get degree distribution.
def getSCComponents
 Gets the strongly connected components of a graph.
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.
 logger
 Logger instance.


Member Function Documentation

def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::deleteEdge (   self,
  edgeNumber 
)

Delete an edge.

Parameters:
edgeNumber Edge number to be deleted

def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::deleteVertex (   self,
  vertexNumber 
)

Deletes a vertex.

Should be used with care

Parameters:
vertexNumber Vertex number to be deleted

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

Get all graph edges.

Returns:
edgeIndex Dictionary of edges, indexed by edge number

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

Get all graph vertices.

Returns:
vertexIndex Dictionary of vertices, indexed by vertex number

def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getVertexNumbers (   self  ) 

Get all graph vertex numbers.

Returns:
an array consisting of all the vertices numbers

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

Get the last edge number.

Returns:
__lastEdgeNumber the last edge number assigned to edges.

def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getNeighbors (   self,
  vertexNumber 
)

Get neighbors for a vertex.

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

def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getDegreeDistribution (   self  ) 

Get degree distribution.

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

def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::UndirectedPowerLawRandomGraph::UndirectedPowerLawRandomGraph.

def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::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