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. |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::addEdge | ( | self, | ||
edge | ||||
) |
Adds an edge to a graph.
It also updates the vertex and edge indices.
edge | Edge of type BaseElements::Edge to be added to the graph |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::deleteEdge | ( | self, | ||
edgeNumber | ||||
) |
Delete an edge.
edgeNumber | Edge number to be deleted |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::addVertex | ( | self, | ||
vertexNumber | ||||
) |
Adds a vertex.
Should be used with care
vertexNumber | Vertex number of vertex to be added |
PackageExceptions::VertexError |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::deleteVertex | ( | self, | ||
vertexNumber | ||||
) |
Deletes a vertex.
Should be used with care
vertexNumber | Vertex number to be deleted |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getEdges | ( | self | ) |
Get all graph edges.
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getVertices | ( | self | ) |
Get all graph vertices.
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getVertexNumbers | ( | self | ) |
Get all graph vertex numbers.
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getLastEdgeNumber | ( | self | ) |
Get the last edge number.
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getNeighbors | ( | self, | ||
vertexNumber | ||||
) |
Get neighbors for a vertex.
vertexNumber | Vertex number for which neighbors have to be obtained |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getNumberOfNeighbors | ( | self, | ||
vertexNumber | ||||
) |
Get number of neighbors for a vertex.
vertexNumber | Vertex number for which number of neighbors have to be obtained |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getDegreeDistribution | ( | self | ) |
Get degree distribution.
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::getSCComponents | ( | self, | ||
getLargest | ||||
) |
Gets the strongly connected components of a graph.
It uses Tarjan's strongly connected components algorithm.
getLargest | If greater than 0, only returns the largest connected component |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::writeCC | ( | self, | ||
fileName, | ||||
allSCC | ||||
) |
Write the connected components to a file.
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.
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.
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.
edgeNumber | Edge number to look for |
PackageExceptions::EdgeError |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::findVertex | ( | self, | ||
vertexNumber | ||||
) |
Find vertex with a given vertex number.
vertexNumber | Vertex number to look for |
PackageExceptions::VertexError |
def pygel::Graph::NumberedEdgeUndirectedGraph::NumberedEdgeUndirectedGraph::hasVertex | ( | self, | ||
vertexNumber | ||||
) |
Checks if vertex is present.
vertexNumber | Vertex number of the vertex to check |