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. |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::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::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::deleteEdge | ( | self, | ||
edgeNumber | ||||
) |
Delete an edge.
edgeNumber | Edge number to be deleted |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::addVertex | ( | self, | ||
vertexNumber | ||||
) |
Adds a vertex.
Should be used with care
vertexNumber | Vertex number of vertex to be added |
PackageExceptions::VertexError |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::deleteVertex | ( | self, | ||
vertexNumber | ||||
) |
Deletes a vertex.
Should be used with care
vertexNumber | Vertex number to be deleted |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getEdges | ( | self | ) |
Get all graph edges.
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getVertices | ( | self | ) |
Get all graph vertices.
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getLastEdgeNumber | ( | self | ) |
Get the last edge number.
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getOutNeighbors | ( | self, | ||
vertexNumber | ||||
) |
Get out-neighbors for a vertex.
vertexNumber | Vertex number for which out-neighbors have to be obtained |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getInNeighbors | ( | self, | ||
vertexNumber | ||||
) |
Get in-neighbors for a vertex.
vertexNumber | Vertex number for which in-neighbors have to be obtained |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getNumberOfOutNeighbors | ( | self, | ||
vertexNumber | ||||
) |
Get number of out-neighbors for a vertex.
vertexNumber | Vertex number for which number of out-neighbors have to be obtained |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getNumberOfInNeighbors | ( | self, | ||
vertexNumber | ||||
) |
Get number of in-neighbors for a vertex.
vertexNumber | Vertex number for which number of in-neighbors have to be obtained |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::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::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getInDegreeDistribution | ( | self | ) |
Get in-degree distribution.
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getOutDegreeDistribution | ( | self | ) |
Get out-degree distribution.
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getJointDistribution | ( | self | ) |
Get joint-degree distribution.
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getDegreeDistribution | ( | self | ) |
Get degree distribution.
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getVerticesByInDegree | ( | self, | ||
degree | ||||
) |
Gets all the vertices with a particular in-degree.
degree | In-degree to look for |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getVerticesByOutDegree | ( | self, | ||
degree | ||||
) |
Gets all the vertices with a particular out-degree.
degree | Out-degree to look for |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::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::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::getOutComponent | ( | self, | ||
stronglyCC | ||||
) |
Gives the out component for a strongly connected component.
stronglyCC | Strongly connected component for which th out-component is to be determined |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::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::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::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::DirectedPowerLawRandomGraph::DirectedPowerLawRandomGraph.
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::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::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::findEdge | ( | self, | ||
edgeNumber | ||||
) |
Find edge with a given edge number.
edgeNumber | Edge number to look for |
PackageExceptions::EdgeError |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::findVertex | ( | self, | ||
vertexNumber | ||||
) |
Find vertex with a given vertex number.
vertexNumber | Vertex number to look for |
PackageExceptions::VertexError |
def pygel::Graph::NumberedEdgeDirectedGraph::NumberedEdgeDirectedGraph::hasVertex | ( | self, | ||
vertexNumber | ||||
) |
Checks if vertex is present.
vertexNumber | Vertex number of the vertex to check |