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. |
|
Adds an edge to a graph. It also updates the vertex and edge indices.
|
|
Adds a vertex. Should be used with care
|
|
Delete an edge.
|
|
Deletes a vertex. Should be used with care
|
|
Find edge with a given edge number.
|
|
Find vertex with a given vertex number.
|
|
Get all graph edges.
|
|
Get in-degree distribution.
|
|
Get in-neighbors for a vertex.
|
|
Get number of in-neighbors for a vertex.
|
|
Get number of out-neighbors for a vertex.
|
|
Get out-degree distribution.
|
|
Get out-neighbors for a vertex.
|
|
Get all graph vertices.
|
|
Gets all the vertices with a particular in-degree.
|
|
Gets all the vertices with a particular out-degree.
|
|
Checks if vertex is present.
|
|
Read edges from file.
|
|
Write edges to file.
|