Graph::NumberedEdgeGraph Class Reference

Inheritance diagram for Graph::NumberedEdgeGraph:

RandomGraphs::PowerLawRandomGraph 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 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 getInDegreeDistribution
 Get in-degree distribution.
def getOutDegreeDistribution
 Get out-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 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.


Member Function Documentation

def Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::addVertex   self,
  vertexNumber
 

Adds a vertex.

Should be used with care

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

def Graph::NumberedEdgeGraph::deleteEdge   self,
  edgeNumber
 

Delete an edge.

Parameters:
edgeNumber Edge number to be deleted

def Graph::NumberedEdgeGraph::deleteVertex   self,
  vertexNumber
 

Deletes a vertex.

Should be used with care

Parameters:
vertexNumber Vertex number to be deleted

def Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::getEdges   self  ) 
 

Get all graph edges.

Returns:
edgeIndex Dictionary of edges, indexed by edge number

def Graph::NumberedEdgeGraph::getInDegreeDistribution   self  ) 
 

Get in-degree distribution.

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

def Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::getOutDegreeDistribution   self  ) 
 

Get out-degree distribution.

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

def Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::getVertices   self  ) 
 

Get all graph vertices.

Returns:
vertexIndex Dictionary of vertices, indexed by vertex number

def Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::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

def Graph::NumberedEdgeGraph::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 Graph::NumberedEdgeGraph::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 RandomGraphs::PowerLawRandomGraph.


Generated on Tue Jul 24 19:51:57 2007 for Python Webgraph Generator by  doxygen 1.4.6